[lug] Shared library question

Eric Weber weber at math.tamu.edu
Tue Jun 20 09:09:35 MDT 2000


I'm trying to learn about creating shared libraries.  I wrote a small 
routine to pop up a message box, then tried to create a shared library
using the following command:
gcc `gtk-config --cflags` -c -fPIC -o libgmsg.so.0.0.1 gmsgbox.c

I then placed this library in /usr/lib, and included the link:
ln -s libgmsg.so.0.0.1 libgmsg.so

I then compiled a program trying to link to this new library using the
command:
gcc `gtk-config --cflags` -o gtktxtvw gtktxtvw.o callbacks.o menu.o -lgmsg
`gtk-config --libs`

Now, the compilation and linking works successfully, and the program runs
as expected, including the calls to the routing in libgmsg.  However, the
problem is that when I run ldd on gtktxtvw, the libgmsg library does not
appear in the output, so it appears that libgmsg is being linked
statically in my program.  Am I missing a step here in generating a shared
library?  Thanks.

Eric Weber
-------------------------------
Department of Mathematics
Texas A&M University
http://www.math.tamu.edu/~weber





More information about the LUG mailing list