#pragma prolog (C only), #pragma epilog (C only)

Category

Object code control

Purpose

When used with the METAL option, inserts High-Level Assembly (HLASM) prolog or epilog code for a specified function.

Prologs are inserted after function entry, and epilogs are inserted before function return in the generated HLASM code. These directives allow you to provide your own function entry and exit code for system programming.

Syntax

Read syntax diagramSkip visual syntax diagram#pragma epilogprolog (function_name , "HLASM Statements")
Starting from z/OS® V1R11, the following syntax is also supported:
Read syntax diagramSkip visual syntax diagram#pragma epilogprolog (function_name , main )

Defaults

Not applicable.

Parameters

function_name
The name of a function to which the epilog or prolog is to be inserted in the generated HLASM code.
HLASM Statements
HLASM Statements is a C string, which must contain valid HLASM statements. If the HLASM Statements consists of white-space characters only, or if the HLASM Statements is not provided, then the compiler ignores the option specification. If the HLASM Statements does not contain any white-space characters, then the compiler will insert leading spaces in front. Otherwise, the compiler will insert the HLASM Statements into the function prolog location of the generated assembler source. The compiler does not understand or validate the contents of the HLASM Statements. In order to satisfy the assembly step later, the given HLASM Statements must form valid HLASM code with the surrounding code generated by the compiler.
Note: Special characters like newline and quote are shell (or command line) meta characters, and maybe preprocessed before reaching the compiler. It is advisable to avoid using them.
main
When the keyword main is specified instead of HLASM Statements, the default prolog/epilog code generated by the compiler for function_name is the same as if it was generated for function main.

Usage

If a #pragma prolog/epilog directive is specified, the pragma directive overrides its respective compiler option.

An HLASM macro name, or any HLASM statements can be specified in the string parameter. Normal programming language (C/C++) rules for string literals apply to the string arguments of the pragma directives as well as to the compiler options.

These directives are only recognized when the z/OS XL C METAL compiler option is in effect.

Only one #pragma epilog or #pragma prolog directive is allowed for a specific function.

Related information