ILE C/C++ Programmer's Guide

Permitting ILE C Programs to Access C++ Linkage Functions


C++ language only
Wrap your header files in the construct shown in the following figure:

Figure 228. Example of Construct that Permits ILE C Programs to Access C++ LInkage Functions


  .
  .
  .
#ifdef __cplusplus
   extern "C" {(1)
   #pragma info(none)
#else
                                  //only if you have #pragma
   #pragma nomargins nosequence   //nomargin and #pragma checkout in the
   #pragma checkout(suspend)      //header file
#endif
   .
   .
   .
#ifdef __cplusplus(2)
   #pragma info(restore)
   }
#else
   #pragma checkout(resume)
#endif
}

Notes:

  1. The linkage specification extern "C" informs the compiler that all functions prototyped will have C linkage. C++ linkage functions cannot be called from C using the C++ internal name. See Chapter 23, Using ILE C/C++ Call Conventions for information on calling functions from other languages.

  2. The macro __ILEC400__ can replace __cplusplus but __cplusplus is preferred because it is portable to other implementations.


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