Sign in Join

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

Mailing lists / fpc-pascal / 2008-07

dynamic libs linux

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner

How can I create and load two dynamic libs A and B under linux, that depend on each other (B uses A)?

For example:
libmy_lib1.so contains the unit lib1unit1.pas with some procs and variables.
And libmy_lib2.so contains the unit lib2unit1.pas with some procs using those in libmy_lib1.so.

I used dlopen from dl.pp to load them. That works without problem as long as lib2 does not use lib1. So I think, that the paths and basic setup works.
But when lib2unit1.pas uses a variable/procedure of lib1unit1.pas, then dlopen returns 0.
I tried with -Cg (PIC) and without.

I built the libs with:
fpc -g -Cg -FUlib lib1unit1.pas
cd lib
ppumove -q -o my_lib1 lib1unit1.ppu
ld -shared -E -o libmy_lib1.so lib1unit1.o
rm lib1unit1.o

Mattias

Reply by email