[Top][All Lists]

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

Re: Problems with linking C-libraries

From: Jose Maria Peña
Subject: Re: Problems with linking C-libraries
Date: Thu, 25 Jan 2001 09:53:03 +0100

Dietmar wrote:


I was a similar problem few week ago. I founded two ways to
solve the problem. For both solutions first you should generate
the object for each of the parts.
.pl files ---> .o (via gplc -c)
.c files ---> .o (via gcc -c)

In order to generate the executable you can use gplc to link
all the object files:
gplc *.o -o my_file                /* You can also add some liker
options */

The second option uses gcc or ld to make the linkage directly.
But you need to add specific prolog libraries and some object
files from the gprolog distributions. You need to provide them
to the linker in a specific order. My Makefile has the following
OBJS= ......o                 #   The object file of your project.
PL_OBJ_DIR=....      # GProlog Library directory
        $(PL_OBJ_DIR)/all_pl_bips.o  \
        $(PL_OBJ_DIR)/libbips_pl.a   \
        $(PL_OBJ_DIR)/obj_end.o      \
        $(PL_OBJ_DIR)/libengine_pl.a \
my_file: $(OBJS)

You may need to add or remove some _EXTRA_OBJS depending
whether you use some or other options (e.g FD support).
This second option is more or less what gplc does when linking.

Personaly, I'd rather use the first one (it is easy) and only if
you need very special options and you have to to manipulate the
linker directly use the second one.


> Hello,
> I got problems, when I tried to compile Prolog-Source-files with
> C-files, because I used certain C-libraries, that couldn't be found
> by gplc. I used the '-L'-Option to pass the library-pathes to the
> linker, but I always got an 'undefined reference' - error.
> I couldn't find any further information in the manual.
> Does anybody know, how I can tell gplc to use certain libraries
> to link, in order to get a native executable?
> _______________________________________________
> Users-prolog mailing list
> address@hidden

Attachment: jmpena.vcf
Description: Card for Jose Maria Peña

reply via email to

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