When I dlsym()
some library, all the global symbols from my main executable can be accessed if referenced in the code of the library.
How can this be avoided? At least no flag for dlsym()
seems to offer such feature.
When I dlsym()
some library, all the global symbols from my main executable can be accessed if referenced in the code of the library.
How can this be avoided? At least no flag for dlsym()
seems to offer such feature.
Try making all symbols in your main executable hidden by default. That is, compile with -fvisibility=hidden
and possibly more options as described here: How to apply gcc -fvisibility option to symbols in static libraries?
This should make your main executable export no symbols, so there will be nothing for the library to find.