users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnu prolog


From: Ciprian Dorin Craciun
Subject: Re: gnu prolog
Date: Mon, 28 Sep 2015 15:37:00 +0300

On Sun, Sep 27, 2015 at 6:59 PM, José Manuel García-Patos
<address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]