Shared library linking to Static library

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

 



Hi,

I have an application which links to two libraries, a static library,
“libstatic.a” and a dynamic library, “libdynamic.so”. The shared
object “libdynamic.so” also internally links to “libstatic.a”. A
global variable is defined in libstatic.a and is accessed in both test
application and libdynamic.so. I'm exporting required symbols of
libdynamic.so to the application using libdynamic.map file with
--version-scripts linker option. libdynamic.map file is defined as:
{
global:
operation_*;
local:
*;
};

This creates two copies of libstatic in the memory. libdynamic shared
object uses its own "private copy" of libstatic. The changes done to
global variables of libstatic by the application is not reflected in
libdynamic.so. Is there any linker option to resolve libstatic symbols
in libdynamic externally? I understand that the simpler workaround in
this case is to pass on the libstatic global variables to libdynamic
in the application. Is there any better solution?

Thanks,
Roopa


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux