6.3 Calling C++ from Prolog

Functions in C++ files that should be called from Prolog must use C linkage, e.g.

extern "C" {
void myfun(SP_integer i)
{…};
};

On Windows, C++ is a first class citizen and no special steps are needed in order to mix C++ and C code.

On other platforms, to build a dynamically linked foreign resource with C++ code, you may have to explicitly include certain libraries and you may need to use an executable compiled and linked with a C++ compiler. The details are platform and C++ compiler dependent and outside the scope of this manual.


Send feedback on this subject.