Node:Interfacing to Cplusplus, Next:, Previous:How to create dynamic linked foreign resources manually, Up:UNIX foreign language interface



Interfacing to C++

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

     extern "C" {
     void myfun(long i)
     {...};
     };
     

To build a dynamic linked foreign resource with C++ code, you may (depending on platform) have to explicitly include certain libraries. E.g. on Sparc/SunOS 5.X using gcc:

     % splfr .... -LD -L/usr/gnu/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0 -lgcc
     

The library path is installation dependent, of course.