User Tools

Site Tools


name_mangling_and_c_compatibility.htm
Navigation:  Language Reference > 2 - Program Source Code Format > Procedure Overloading >====== Name Mangling and C++ Compatibility ====== Previous pageReturn to chapter overviewNext page

Each overloaded function will have a link-time name composed of the procedure label and a “mangled” argument list (the NAME attribute can be used to disable name mangling). This is designed so that some degree of cross-calling between C++ and Clarion is possible. On the C++ side you need:

#pragma name(prefix⇒“”)

and the name in all caps. On the Clarion side you need a MODULE structure with a null string as its parameter:

MODULE() END The only procedures that can be cross-called are those whose prototypes only contain data types from the following list. Clarion Variable-parameters (passed by address) correspond to reference parameters on the C side unless they are omittable, in which case they correspond to pointer parameters. Clarion               C++ BYTE                  unsigned char USHORT                unsigned short SHORT                 short LONG                  long ULONG                 unsigned long SREAL                 float REAL                  double *CSTRING (with RAW)   char&amp; <;*CSTRING> (with RAW) char* <;*GROUP> (with RAW)   void* Note that for C++ compatibility the return type of a PROCEDURE is not mangled into the name. A corollary effect is that procedures cannot be distinguished by return type. Example: C++ prototypes: #pragma name(prefix⇒“”) void HADD(short,short); void HADD(long*,unsigned char); void HADD(short unsigned &amp;); void HADD(char *,void *); !Clarion prototypes: MODULE('')  hADD(short,short)  HaDD(<;*long>,byte)  HAdD(*ushort)  HADd(<;*CSTRING>,<;*GROUP>),RAW END See Also:** NAME

name_mangling_and_c_compatibility.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1