Calling Prolog predicates from a C program.



Hi all,
I would like to have a standalone executable that makes prolog queries
and prints out the results. Here is my implementation.

/* Start*/
#include"SWI-Prolog.h"
main(int argc,char **argv)
{

if ( !PL_initialise(argc, argv) )
PL_halt(1);
static predicate_t pred_id;
term_t t0=PL_new_term_refs(4);
pred_id=PL_predicate("my_getdata",4,"getdata");
PL_call_predicate(NULL,PL_Q_NORMAL,pred_id,t0);
}
/* End*/

I am trying to compile this program using the following command.
'plld temp.c -L .'

On doing this, I am getting the following error:
temp.o(.text+0x1a): In function `main':
: undefined reference to `PL_initialise'
temp.o(.text+0x2b): In function `main':
: undefined reference to `PL_halt'
temp.o(.text+0x38): In function `main':
: undefined reference to `PL_new_term_refs'
temp.o(.text+0x52): In function `main':
: undefined reference to `PL_predicate'
temp.o(.text+0x6c): In function `main':
: undefined reference to `PL_call_predicate'
collect2: ld returned 1 exit status
gcc returned code 256
*** plld exit status 1

The libpl.a is in the same directory as the file temp.c


Can someone help me in resolving the linker errors above.

Thanks in advance.
Sujai.

.



Relevant Pages

  • Xilinx EDK : mb-gcc linker errors with C++ features
    ... linker errors result for "realloc" if Library/OS parameters ... system.make program; exit;" Started... ... write.o: undefined reference to `outbyte' ... same linker errors occur as listed above. ...
    (comp.arch.fpga)
  • Linker errors with Dev-C++
    ... and I am getting all kinds of linker errors. ... How can I fix this undefined reference errors ?? ... Compiler: Default compiler ... (int&, char**, unsigned char)' ...
    (alt.comp.lang.learn.c-cpp)
  • QT - missing library ?
    ... When trying to compile the first example of QT Tutorial1 (see ... source below) I happen to get a lot of linker errors. ... In function `main':: undefined reference to ...
    (comp.os.linux.development.apps)
  • port XFree86 linker failure
    ... Building the latest XFree86 port gives linker errors against what looks like ... some guidance before I go waving a hammer at it (deinstall/reinstall ... help.o: undefined reference to `XawTextSinkConvertPropertyList' ... help.o: undefined reference to `XawTextGetSink' ...
    (freebsd-questions)
  • Re: Calling Prolog predicates from a C program.
    ... > I am trying to compile this program using the following command. ... >: undefined reference to `PL_initialise' ... > gcc returned code 256 ... link commands. ...
    (comp.lang.prolog)