Function not executed

I want to understand the following scenario as what exactly happens. I have a shared library (A) that loads another shared library (B) by dynamic loading. Library A also provides several methods (F1).

The main program loads library A, and then library A loads library B to a later point. Now, when library B tries to use the F1 function from library A, it cannot load its symbol, and compilation stops execution without any warnings / errors or the kernel. Although I see these characters exported from library A (using the nm command). I'm not very sure what exactly is happening. I watched this on Linux. 64. The same script works on windows.

+3
source share
1 answer

My psychic debugging abilities tell me that since you marked this as C ++, you are compiling C ++ code. I also assume that you used slightly different options to compile the A and B libraries, as a result of which their decoration of names and / or ABI were incompatible, and therefore the method could not be found.

Do you think letting the linker apply all common objects to your application, rather than using it dlopen? Then you will immediately recognize that a problem has occurred because the linker could not match the characters.

Alternatively, maybe Linux just doesn't like your links to circular libraries: can you reorganize libraries to eliminate circular dependency?

0
source

All Articles