Resources | Resources |



IDL methods in C++

Each method of an interface is mapped as a pure virtual function of the C++ class.

To maintain the same calling conventions as the C bindings, each virtual function might contain compiler specific attributes to ensure this requirement. For example, the virtual functions of a C++ class will have the __cdecl calling convention when compiled using the Microsoft C++ compiler. Consider the following example:

interface IFoo
    long process(in short a);

is mapped as:

struct IFoo 
    virtual int CDECL process(short int a) = 0;

where CDECL is defined as:

#ifdef _MSC_VER // MS C++ specific
  #define CDECL __cdecl
#else           // All other compilers
  #define CDECL