I'm finding that when I link an executable against a static library (.a), the symbols from the static library end up being exported by the executable file. I would like to avoid this and export nothing.
I've tried providing a version script, but it seems to make no difference. The contents of my version script are as follows:
{
global:
main;
local:
*;
};
Is there a way to not export symbols from an executable when linking in a static library? I can't recompile the static library itself.
Executables don't export symbols by default, and will not do so unless you use -Wl,--export-dynamic. This is necessary only if you're dynamically loading libraries that themselves need to link into symbols in the main executable (this is a common case in C++ if your libraries contain classes which override virtual methods in the exe)
Perhaps you're confusing exporting symbols with having debug symbols. Debug symbols will be produced for the benefit of the debugger (if you don't strip the exe), but are not required to run.
Use strip
?
$ man strip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With