c++ - Can I wrap a shared library in a static library to contain its dependencies? -
i have been provided shared library file third party (call libfoo.so
link application. not have source code libfoo.so
, associated c++ headers , resulting binary provided third party. libfoo.so
has few shared library dependencies, notably few boost libraries, such libboost_thread.so.1.48
. other that, dependency list thin (essentially libstdc++.so.6
).
here's catch: application, uses boost heavily, built against newer version, v1.55. therefore, if try link application against v1.55 libraries needs v1.48 libraries libfoo.so
pulls in, i'm bound run problems duplicate symbols; that's non-starter. roll application v1.48 little work, i'd prevent 1 dependency holding me changing boost versions in future.
is there kind of intermediate product create sits between libfoo.so
, application decouple boost dependencies each other? found number of similar questions, none find captured particular situation; it's not boost-specific per se, instead relates devising way link multiple abi-incompatible shared library versions single application.
one rough idea came (which i'm not sure possible): possible create wrapper library sits around libfoo.so
, resolves of dependencies statically? if there way take libfoo.so
, various shared libraries links , create static library, libfoowrapper.a
, link application directly (with caveat i'm careful not leak boost stuff wrapper library's interface, guard against abi incompatibilities 2 versions).
is there way accomplish this? @ first, i'm operating on unix-like platforms using gcc
(linux, macos); windows (using visual studio) in future.
Comments
Post a Comment