For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > May 2004 > dynamically linked lib inter-dependency problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author dynamically linked lib inter-dependency problem
Dave

2004-05-15, 2:31 am

Hi,

Got some question regarding to the dlls under Unix/Linux.

I have a dll lib say libA.so and two other libs libB.so and libC.so.
They are created from different object files. The source codes of
libA.so use some class names and functions defined in libB.so and
libC.so. I can build libA.so, libB.so and libC.so individually without
cross-using the objects from other libs. For example, build libA.so
without using the object files in libB.so. However, when I use dlopen
to open libA.so, and use dlerror to check errors, I got some symbols
undefined. These symbols came from those object files used for libB.so
and libC.so. So, if I use those object files used for libB.so and
libC.so to build libA.so, dlerror will not complain anymore.

My question is can I really use those object files which are used to
create libB.so and libC.so to build libA.so? My understanding is dll's
should be independent from each other. My second questions is how
about the case when I don't have access to those object files used for
libB.so and libC.so, say they are vendor based libs and no object
files available?

The last thing is the above problem doesn't occur at all on solaris
platform but does occur on linux platform. Why?
Bart Smaalders

2004-05-15, 2:31 pm

<original article was heavily cross-posted; I'm replying
to this from a Solaris perspective>

You might want to spend some time looking through the
Linker and Libraries manual (on-line at docs.sun.com)
to gain some understanding of just dynamic linking works
and how to use it effectively.

In a nutshell, best results are obtained as follows:

* build each shared library so that it's dependencies are
fully satisfied by linking with all the other shared libraries
it needs. Avoid duplicating .o files in different libraries;
link with those libraries instead. One can be sure that all
dependencies are satisfied with the -zdefs flag on Solaris.

* Make sure run paths, etc, are fully specified so that the dynamic
linker can find where you installed the libraries as opposed to
where they were when you linked against them...

- Bart

davis_eric@yahoo.com (Dave) wrote in message news:<99f6e996.0405142121.68de7ed9@posting.google.com>...
> Hi,
>
> Got some question regarding to the dlls under Unix/Linux.
>
> I have a dll lib say libA.so and two other libs libB.so and libC.so.
> They are created from different object files. The source codes of
> libA.so use some class names and functions defined in libB.so and
> libC.so. I can build libA.so, libB.so and libC.so individually without
> cross-using the objects from other libs. For example, build libA.so
> without using the object files in libB.so. However, when I use dlopen
> to open libA.so, and use dlerror to check errors, I got some symbols
> undefined. These symbols came from those object files used for libB.so
> and libC.so. So, if I use those object files used for libB.so and
> libC.so to build libA.so, dlerror will not complain anymore.
>
> My question is can I really use those object files which are used to
> create libB.so and libC.so to build libA.so? My understanding is dll's
> should be independent from each other. My second questions is how
> about the case when I don't have access to those object files used for
> libB.so and libC.so, say they are vendor based libs and no object
> files available?
>
> The last thing is the above problem doesn't occur at all on solaris
> platform but does occur on linux platform. Why?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com