Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2003-01

How to call fpc functions from C ? (fwd)

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Miroslav Ilias

Dear all,

we know how to call C-function from Pascal (on Linux at least). However, there are problems when trying to call Pascal function or procedure from the C-source.
First I define the *pas file as a library and I link it with the C file. But the exe file gives error message: a.out: error while loading shared libraries: libfpclib.so: cannot open shared object file: No such file or directory.

Please how do I solve it ? The demo files are attached. Thanks, Miro.

Reply by email

Jonas Maebe
to Miroslav Ilias
Miroslav Ilias wrote 11 lines
we know how to call C-function from Pascal (on Linux at least). However, there are problems when trying to call Pascal function or procedure from the C-source. First I define the *pas file as a library and I link it with the C file. But the exe file gives error message: a.out: error while loading shared libraries: libfpclib.so: cannot open shared object file: No such file or directory.

Either move the created library to (/usr)/lib, or add the current directory to the LD_LIBRARY_PATH environment variable. However, note that shared library creation isn't really working yet (the init routines of the necessary units, such as the system unit, aren't called so routines that rely on that - such as most IO routines and the heap manager - will not work)

Jonas

Reply by email