users-prolog
[Top][All Lists]
Advanced

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

Re: Linking prolog code


From: Daniel Diaz
Subject: Re: Linking prolog code
Date: Tue, 09 Jan 2001 20:57:13 +0100

Hello Jose Maria,

You can compile your own C code (not interfacing Prolog) using gcc as well as 
gplc (you can pass C compiler options using the -C gplc option), so the 
following command lines work:

   gcc FLAGS -c -o my_own_c_doe.o my_own_c_code.c
   gplc -C "FLAGS" -c my_own_c_code.c

Your C code interfacing Prolog is compiled using gplc (as shown above)

   gplc -C "FLAGS" -c prolog_control_interface.c

Your Prolog code is compiled using gplc:

  gplc -c controler.pl

To link:

   gplc -o EXECNAME controler.o prolog_control_interface.o asmstuff.o 

You can obviously do the same in one command-line (even if not realistic 
using a Makefile):

   gplc -o EXECNAME controler.pl prolog_control_interface.c my_own_c_code.c 
asmstuff.o


To see the command-lines invoked by gplc use the -v option

address@hidden said:
> Hi:
> I want to put together some pieces of code in a small project. Most of
> the files are C, but I also need to include some Prolog code for some
> control features. There are some Assembler and other weird stuff in
> the project.

> Do I need to compile the whole project with 'gplc'? Do I have any
> solution like:?
>     - Using gplc: Generate  an object file from my prolog sources and
> from
>         any file that calls prolog from C (via 'Pl_Query_Start')
>     - Compile the other files using gcc and other compilers to
> generate .o
>        files. Such as:
>                 gplc -c controler.pl
>                 gplc -c prolog_control_interface.c

>     - Finally, link everything using gplc or ld with the appropriate
> libraries
>        (I don't know exactly which).

> I don't want to re-write everything in C or Prolog and I wish to use
> different tools to build the project and I need to link with some
> libraries.

> I remember there was a similar question a lot of time ago but I
> couldn't

> find it in my mailbox. If it is so, would somebody submit it again to
> the list?.

> Thanks in advance,
>     Chema


-- 
===============================================
                 Daniel Diaz
University of Paris 1      INRIA Rocquencourt
75013 Paris FRANCE      78153 Le Chesnay FRANCE
        web: http://pauillac.inria.fr/~diaz
        email: address@hidden
===============================================

-- 
===============================================
                 Daniel Diaz
University of Paris 1      INRIA Rocquencourt
75013 Paris FRANCE      78153 Le Chesnay FRANCE
        web: http://pauillac.inria.fr/~diaz
        email: address@hidden
===============================================





reply via email to

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