[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

shared library problem



I've encountered a slight problem while working on dpkg-db that I don't
know how to fix. Here is the situation: I have an executable that loads
a library, which uses libgdbm. Here is how I compile it:

[thunder;~/cm]-18> make
gcc -Wall -g -shared -o module.so module.c -lc -lgdbm
chmod a-x module.so
gcc -Wall -g -o main main.c -ldl

Now when I run this things go wrong:

[thunder;~/cm]-19> ./main 
Initializing
Segmentation fault (core dumped)
Exit 139

What happens is that main calls a function in the module which prints the
text "Initializing", which works. Then it calls another function that uses
something from libgdbm. And then the shit hits the fan..

I can workaround this by linking main with libgdbm, but that is of course
not acceptable. I could probably fix this by making the module load
libgdbm manually, but that seems like an ugly hack. Can someone help
me with this?

Wichert.


Attachment: pgpz2jGKbWchO.pgp
Description: PGP signature


Reply to: