[PPL-devel] Re: gplc and linking with other libraries

FORT David david.fort at intranode.com
Wed Mar 6 11:39:52 CET 2002


users-prolog-admin at gnu.org wrote:

>
> Hi there,
>
> I have just started playing with GNU Prolog's foreign language interface
> (among other things, I am trying to write a GNU Prolog interface for the
> Parma Polyhedra Library, http://www.cs.unipr.it/ppl/).
>
> One of the difficulties I have encountered is with the gplc command:
> while it allows to specify extra options for the linker (with -L),
> these options are passed as the first ones in the link command.
> This would seem to imply that there is no way to link with your
> own libraries (in addition to the ones needed by GNU Prolog itself).
> In fact, a command like
>
>      gplc -o EXENAME some.pl some.o -L '-Lmylibdir -lmylib'
>
> results in a link command of the form
>
>      gcc -Lmylibdir -lmylib ...
>
> and this is such that the library `libmylib' is simply disregarded.
> Is there a workaround for this?
> I would like very much to avoid
>
> 1) including the entire library in my executable when I need only
>    a part of it;
> 2) having to specify the complete path of libraries (I would like
>    the linker to look for them in the appropriate places);
> 3) linking manually, thus having to guess which library are needed
>    by GNU Prolog itself.
>
> Am I imposing an unsatisfiable set of constraints?
> Thanks a lot
>
>     Roberto
>
I had to do many tricks for linking a program of mine, as it uses
C++ and i wanted it to be under automake/autoconf.
The only solution i found was to do a
    gplc -v <file>
To have the order of linking done by gplc.

And i just copy&paste this linking directive, and added the things
that were required by my application.

PS: all prolog mapped function must be linked between "obj_begin.o" and 
"obj_end.o"
PPS: if anybody has a trick to dynamically register the predicate from 
C,  i'm interested.
This would allows me to have Prolog compiled in a shared library module, 
that i could
load and unload when needed.

-- 
-- FORT David - david.fort at intranode.com --
-- Intranode Software Technologies --------
----- Security you can see. ---------------






More information about the PPL-devel mailing list