c++ - Can I build a shared library by linking static libraries? -
c++ - Can I build a shared library by linking static libraries? -
i have bunch of static libraries (*.a), , want build shared library (*.a) link against static libraries (*.a). how can in gcc/g++? thanks!
you can (just extract .o
files , link them -shared
create .so
), whether works, , how works, depends on platform , whether static library compiled position-independent code (pic). on platforms (e.g. x86_64), non-pic code not valid in shared libraries , not work (actually think linker reject create .so
). on other platforms, non-pic code work in shared libraries, in-memory re-create of library not sharable between different programs using or different instances of same program, result in huge memory bloat.
c++ c gcc shared-libraries static-libraries
Comments
Post a Comment