Thread View: gmane.comp.ai.prolog.swi
2 messages
2 total messages
Started by Tansu Senyurt
Tue, 16 Apr 2002 01:40
Shared library Problem
Author: Tansu Senyurt
Date: Tue, 16 Apr 2002 01:40
Date: Tue, 16 Apr 2002 01:40
62 lines
1908 bytes
1908 bytes
We used prolog engine one of our Projects and now we want to compile the project as library so we can use it with other applications. The problem is that, we can compile the whole program in to the library but when we try to compile a program that uses this library we get some errors like: (for examples i already compiled the project as libgain.so) .//libgain.so: undefined reference to `PL_initialise' ..//libgain.so: undefined reference to `PL_close_foreign_frame' ..//libgain.so: undefined reference to `PL_put_term' ..//libgain.so: undefined reference to `PL_copy_term_ref' ..//libgain.so: undefined reference to `PL_cut_query' ..//libgain.so: undefined reference to `PL_new_term_refs' ..//libgain.so: undefined reference to `PL_chars_to_term' to be more precise: We used C++ for the project implementation and SWI-cpp.h is included to the project. There are several sorce files in the project and one of the classes uses the prolog engine. We initialize the prolog endine in the main function (main function's name is changed to "gain()" for compiling as library). I used g++ -c *.cc ar rlv libgain.a *.o ranlib libgain.a Until this point everything seems OK. I wrote a test cpp file in order to test the library. It's something like that: void gain(); int main(){ gain(); } I named this file test.cpp then i tried to compile the file using the libgain.a g++ test.cc -L./ -lgain then i got the errors listed above. The project is compiled on Linux i686 g++ version 2.95.3 pl version 4.0.11 Any help? ---------------- * To UNSUBSCRIBE, please use the HTML form at http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe" (without the quotes) and *no* message body. ** An ARCHIVE of this list is maintained at http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/
Re: Shared library Problem
Author: Jan Wielemaker
Date: Tue, 16 Apr 2002 10:15
Date: Tue, 16 Apr 2002 10:15
74 lines
2493 bytes
2493 bytes
On Tuesday 16 April 2002 00:40, Tansu Senyurt wrote: > We used prolog engine one of our Projects and now we want to compile the > project as library so we can use it with other applications. > The problem is that, we can compile the whole program in to the library > but when we try to compile a program that uses this library > we get some errors like: (for examples i already compiled the project as > libgain.so) > > .//libgain.so: undefined reference to `PL_initialise' > .//libgain.so: undefined reference to `PL_close_foreign_frame' > .//libgain.so: undefined reference to `PL_put_term' > .//libgain.so: undefined reference to `PL_copy_term_ref' > .//libgain.so: undefined reference to `PL_cut_query' > .//libgain.so: undefined reference to `PL_new_term_refs' > .//libgain.so: undefined reference to `PL_chars_to_term' > > to be more precise: > > We used C++ for the project implementation and SWI-cpp.h is included to > the project. There are several sorce files in the project and one of the > classes uses the prolog engine. We initialize the prolog endine in the > main function (main function's name is changed to "gain()" for compiling > as library). I used > > g++ -c *.cc > ar rlv libgain.a *.o > ranlib libgain.a > > Until this point everything seems OK. > > I wrote a test cpp file in order to test the library. It's something > like that: > > void gain(); > int main(){ > gain(); > } > I named this file test.cpp then i tried to compile the file using the > libgain.a > > g++ test.cc -L./ -lgain > > then i got the errors listed above. The project is compiled on Linux i686 > g++ version 2.95.3 > pl version 4.0.11 At least the platform is clear now :-) Not clear however is what you do to Prolog. From what I see, it looks like you simply don't include it anywhere in your project. I guess thats not true!? Normally, if you have libgain.a and some main program you should be able to do plld -o test test.cc -L. -lgain Add -v to see what is going on. Basically it will add -L/dir/to/prolog/lib -lpl and whatever libraries are needed on the hosting system to build Prolog. --- Jan ---------------- * To UNSUBSCRIBE, please use the HTML form at http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe" (without the quotes) and *no* message body. ** An ARCHIVE of this list is maintained at http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads