ILE C/C++ Compiler Reference

linkage syntax
>>-#--pragma--linkage--(--+-program_name-+--,------------------->
'-typedef_name-'
>--OS--+------------+--)---------------------------------------><
'-,--nowiden-'
Description
Identifies a given function or function typedef as
being an external program subject to i5/OS parameter passing conventions.
This pragma allows calls only to external programs.
For information about making calls to bound procedures, see #pragma argument .
Parameter
- program_name
- Specifies the name of an external program. The
external name must be specified in uppercase characters and be no
longer than 10 characters in length, unless the #pragma map directive
is specified to meet i5/OS program naming conventions. However, if
the name specified in #pragma map is too long, it will be truncated
to 255 characters during #pragma linkage processing.
- typedef_name
- Specifies a typedef affected by this pragma.
- OS
- Specifies that the external program is called
using i5/OS calling conventions.
- nowiden
- If specified, arguments are not widened before they are copied
and passed.
Notes® on
Usage
This pragma lets an IBM i program call an external
program. The external program can be written in any language.
The pragma can be applied to functions, function types, and function
pointer types. If it is applied to a function typedef, the effect
of the pragma also applies to all functions and new typedefs declared
using that original typedef.
This directive can appear either before or after the program name
(or type) is declared. However, the program cannot have been called,
nor a type been used in a declaration, before the pragma directive.
The function or function pointer can only return either an int or
a void.
Arguments on the call are passed according to the
following i5/OS argument-passing conventions:
- Non-address arguments are copied to temporary locations, widened
(unless nowiden has been specified) and the address of
the copy is passed to the called program.
- Address arguments are passed directly to the called program.
The compiler issues a warning message and ignores the #pragma linkage
directive if:
- The program is declared with a return type other than int or void.
- The function contains more than 256 parameters.
- Another pragma linkage directive has already been specified for
the function or function type.
- The function has been defined in the current compilation unit.
- The specified function has already been called, or the type already
used in a declaration.
- #pragma argopt or #pragma argument has already been specified
for the named function or type.
- The object named in the pragma directive is not a function or
function type.
- The name of the object specified in the pragma directive must
not exceed 10 characters, or the name will be truncated.
[ Top of Page | Previous Page | Next Page | Contents |
Index ]