On Sun, Sep 27, 2015 at 6:59 PM, José Manuel García-Patos <jm.inf...@gesaku.es> wrote: > On 25/09/15 12:46, João Mariz Graça wrote: > GTK+ is written in C; but even if it weren't, C++ is a superset of C, so, > unless I'm mistaken, whatever applies to C should apply to C++ as well.
Unfortunately, due to at-compile-time renaming of functions written in C++ (to support argument overloading, templates, etc.), you can't directly link against a C++ function (even if it doesn't use any C++ features). Usually you'll have to write a wrapper API in C++ that eliminates all object-oriented (and other C++) features from its interface (i.e. exported functions), and usually translate pointers to classes into `typedef void * class_X_t`, which you then have to cast inside these wrapper functions. (This functions have to be marked as `extern "C"`.) Then you can use these wrapper functions. However note that linking also requires additional libraries (that implement the C++ run-time). (I haven't done this is quite a time, so I can't be more specific than this, however a good place to look is for example how various C++ libraries are adapted for the Go language.) Ciprian. _______________________________________________ Users-prolog mailing list Users-prolog@gnu.org https://lists.gnu.org/mailman/listinfo/users-prolog