ILE C/C++ Compiler Reference


argument



>>-#--pragma--argument------------------------------------------>
 
>--(--function_name--+-,--OS--+------------+---+--)------------><
                     |        '-,--nowiden-'   |
                     +-,--VREF--+------------+-+
                     |          '-,--nowiden-' |
                     '-,--nowiden--------------'
 
 

Description

Specifies the argument passing and receiving mechanism to be used for the procedure or typedef named by function_name.

This pragma identifies procedures as externally bound-procedures only. The procedure may be defined in and called from the same source as the pragma argument directive. If the pragma argument directive is specified in the same compilation unit as the definition of the procedure named in that directive, the arguments to that procedure will be received using the method specified in that pragma directive.

For information on making calls to external programs, see pragma linkage .

Parameters

function_name
Specifies the name of the externally-bound procedure.

OS
OS indicates that arguments are passed, or received (if the pragma directive is in the same compilation unit as the procedure definition), using the OS-Linkage argument method. Non-address arguments are copied to temporary locations and widened (unless nowiden has been specified), and the address of the copy is passed to the called procedure. Arguments that are addresses or pointers are passed directly to the called procedure.

VREF
VREF is similar to OS-linkage with the exception that address arguments are also passed and received using the OS-Linkage method.

nowiden
Specifies that the arguments are not widened before they are passed or received. This parameter can be used by itself without specifying an argument type. For example, #pragma argument (myfunc, nowiden), indicates that procedure myfunc will pass and receive its arguments with the usual by-value method, but unwidened.

Notes on Usage

This pragma controls how parameters are passed to bound-procedures and how they are received. The function name specified in the #pragma argument directive can be defined in the current compilation unit. The #pragma argument directive must precede the function it names.

Specifying a #pragma argument directive in the same compilation unit as the affected procedure tells the compiler that the procedure is to receive (as well as to send) its arguments as specified in the pragma argument directive. This is useful for ILE C written bound-procedures specified in a pragma argument. The user must ensure that if the call to the procedure and the definition are in separate compilation units, the pragma argument directives must match in regards to their passing method ( OS, VREF, and nowiden).

For example, in the two source files below, the address of a temporary copy of the argument will be passed to foo in Program 1. Program 2, foo will receive the address of the temporary copy, dereference it, and assign that value to the parameter a. If the two pragma directives differ, behavior is undefined.

Program 1 Program 2
#pragma argument( foo, OS, nowiden)
void foo(char);
void main() {
   foo(10);
}
#pragma argument( foo, OS, nowiden )
void foo( char a ) { a++; }

Warnings are issued, and the #pragma argument directive is ignored if any of the following occurs:


[ Top of Page | Previous Page | Next Page | Table of Contents ]