ILE C/C++ Programmer's Guide
Use the #pragma linkage and #pragma
argument directives to specify the linkage convention. See Table 19 and Accessing ILE C Procedures from Any ILE Program for more information on using
these directives.
When specifying linkage conventions, consider the following C++
characteristics:
- A C++ program uses the standard OS linkage calling convention. Use
the #pragma linkage directive to flag the function call as an
external program call.
- When you call C++ functions, you must make sure that the sender and
receiver both agree on the type of parameter being passed, whether it is by
pointer or by value, and whether parameters are widened. For example,
if the function you are calling was declared as extern "C nowiden",
you must use the #pragma argument(func, nowiden) directive
in the function declaration in ILE C.
- You can declare a C++ function as external by explicitly declaring the
function within the C++ code using either extern "C" or extern
"C nowiden". You can add #ifdef statements to
the function declarations in the header files used by both C and C++ modules,
as shown in Figure 198.
Figure 198. An ILE C++ Function Declared As an External Function
#ifdef __cplusplus
extern "C" {
#endif
function declarations
#ifdef __cplusplus
}
#endif
|
- Note:
- These statements are declared with C linkage.
[ Top of Page | Previous Page | Next Page | Table of Contents ]
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.