ILE C/C++ Programmer's Guide

Using Dual Function Prototypes

To allow your header files to be used by ILE C and ILE C++ compilers, all functions with "OS" linkage type require dual prototypes, as shown in the following figure:

Figure 226. Example of a Single Set of Dual Prototypes that Allow a Header File to be Used by Both ILE C and ILE C++


#ifdef __cplusplus
   extern "linkage-type"  //linkage type "OS"
#else
   #pragma linkage(function_name,linkage_type)
#endif
void function_name(...);

If you have a list of functions that need dual prototypes, you can use the syntax shown in the following figure:

Figure 227. Example of Multiple Sets of Dual Prototypes that Allow a Header File to be Used by Both ILE C and ILE C++


#ifdef __cplusplus
   extern "linkage-type"  {  //linkage type "OS"
#else
   #pragma linkage(function_name1, linkage_type)
   .
   .
   #pragma linkage(function_nameN, linkage_type)
#endif
void function_name1(...);
   .
   .
void function_nameN(...);
#ifdef __cplusplus
}
#endif


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