Hello, I'm building a Windows dynamic library using the MinGW toolchain.
To build this library I'm statically linking to other 2 which offer an API and I have a .def
file where I wrote the only symbol I want to be exported in my library.
The problem is that GCC is exporting all of the symbols including the ones from the libraries I'm linking to. Is there anyway to tell the linker just to export the symbols in the def
file?
I know there is the option --export-all-symbols
but there seems not to be the opposite to it.
Right now the last line of the build script has this structure:
g++ -shared CXXFLAGS DEFINES INCLUDES -o library.dll library.cpp DEF_FILE \
OBJECT_FILES LIBS -Wl,--enable-stdcall-fixup
EDIT: In the docs about the linker it says that --export-all-symbols
is the default behavior and that it's disabled when you don't use that option explicitly if you provide a def
file, except when it doesn't; the symbols in 3rd party libs are being exported anyway.
EDIT: Adding the option --exclude-libs LIBS
or –exclude-symbols SYMBOLS
doesn't prevent the symbols from the libraries from being exported.