[fpc-pascal]linking pascal objects/units into C

Oliver Graf ograf at rz-online.net
Tue Jun 19 08:37:42 CEST 2001


On Mon, Jun 18, 2001 at 08:52:30PM +0200, Peter Vreman wrote:
> You need to create a library. The library will include all the required units.

Ok, I did this.

> This will create a file libtest.so. Copy this file into /usr/lib or any 
> other path searched by ld. Then run ldconfig to update the ld.cache file. 
> And finally you can compile test.c and link the library with:

I did set LD_LIBRARY_PATH and use -L. in the gcc call.
> gcc -o test test.c -ltest

Yep, so linking works... but... no output is given by the pascal
procedure. If I do some output in C after the pascal call, it also is
not executed. The binary simply returns to commandline and the exit
code of the programm is 103 (is this something pascalisch?).

If I use Fernandos example, it works indeed! But he moves output to

I could do that, but I don't know if our project uses pascal
libraries internally, I just have an API to work with and I'm the
lucky one who has to write the perl and the python modules... Oh, one
thing I know: it is completely object oriented inside! Is this also a
problem (there are some object libs in the rtl path)?

But I will talk back to the pascal developer, perhaps he only uses
self-written stuff...

But on the other hand: There must be a way to link the pascal stuff
into my C stuff, or not?

Thanxx for the quick help!


More information about the fpc-pascal mailing list