On Wed, 24 May 2006 11:49:03 +0200 (CEST) Michael Van Canneyt <[EMAIL PROTECTED]> wrote:
> > > On Wed, 24 May 2006, Dominique Leducq wrote: > > > Hi again, > > > > I still don't succeed in linking Free Pascal compiled code with a C program. > > > > When linking with the shared library built by fpc, I have problems with > > undefined symbols, which are defined in the loaders. > > > > $ gcc -o test_shared test2.o -L. -lsoTest3 > > ./libsoTest3.so: undefined reference to `__stkptr' > > ./libsoTest3.so: undefined reference to `_haltproc' > > ./libsoTest3.so: undefined reference to `operatingsystem_parameter_argc' > > ./libsoTest3.so: undefined reference to `operatingsystem_parameter_argv' > > collect2: ld returned 1 exit status > > > > When linking in the loader prt0.o too, there are symbol conflicts with > > /usr/lib/crt1.o (_start, __data_start) if I call ld through gcc. > > > > $ gcc -o test_shared test2.o prt0.o -L. -lsoTest3 > > prt0.o: In function `_start': > > (.text+0x0): multiple definition of `_start' > > /usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../../lib64/crt1.o:../sysdeps/x86_64/elf/start.S:65: > > first defined here > > prt0.o: In function `data_start': > > (.data+0x0): multiple definition of `__data_start' > > /usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../../lib64/crt1.o:(.data+0x0): > > first defined here > > collect2: ld returned 1 exit status > > > > > > Exactly the same happens when linking statically. > > > > > > If I call ld directly, linking succeeds, but the main() of the C program > > never gets called... > > > > However, according to the FPC Programmer's Guide, "using a pascal library > > from a C program" (12.4) seems to be supported... > > > > Do I miss something ? > > That statement means that you can create a separate library, > which can be called from a C program. > That is actually what I want to do. How can I achieve this ? I followed the steps in the Programmer Guide, to no avail. > Doing what you want is to include pascal object files directly in a C program. > That is only possible if you create your own loader stub. > > Michael. _______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
