[lug] Shared library question
D. Stimits
stimits at idcomm.com
Tue Jun 20 22:39:52 MDT 2000
Eric Weber wrote:
>
> 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`
Try adding this in to your second line (linking), near the start:
-shared -Wl,-export-dynamic,-soname,libgmsg.so.0
I'm not sure you need all that, such as export-dynamic, but I don't
think it'll hurt.
>
> 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
>
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
More information about the LUG
mailing list