Ok, I am pretty sure this is a bug in the dynamic linker, but I'll post here anyway to see, if someone has a straightforward explanation of the phenomenon. Short store: You take libjpeg.so (which is, apparently, a c only lib). You then create a c++ file referencing it, remembering to #include
, so that the c symbols are recognized. You then create a shared object out of the c++ file you just created, remembering to use the -shared flag with c++. You then create a main c++ file referencing the newly created shared object in a way, that triggers its reference to libjpeg.so. Link it, and what do you get? All your jpeg symbols are 0!
If you reference jpeg in the main c++ file, there are no problems.
This problem seems to only occur when mixing c and c++ shared objects in a way, so the c objects are subordinate to the c++ objects. Solution??
See my full project here (just run "make" on it):
EDIT: Ok, apparently this problem only arise with some shared objects. Tried:
So something must be fishy with libjpeg.so and libpng.so. Objdump shows, that all the symbol names are preceded by a library version string, as contrary to libz... Could that be an issue...?
Wed, 2013-08-21 18:50#1
Shared objects and c/c++ symbol malfunction