Is there, a perhaps undocumented way to prevent linker from creating IMPLIB
for a DLL or an EXE, despite having __declspec
(dllexport) directives within the source code?
Specifying no /IMPLIB
results in .LIB
created with a default name.
This is important when the declspec directives arrive from 3rd party code which is not under control. This is, for example, the case with boost::serialization
. A possible solution would be a way to "undeclare" a DLL export. DEF file also cannot do it (AFAIK), because it can only add to the export list but not remove from it.
Many 3rd party code does not use __declspec(dllexport)
directly, but hides it under a macro in order to control it. Typically they want to switch between dllexport
and dllimport
depending on where the header file is included (inside the dll implementation or by the user of the dll)
If that is the case in the library you try to include it should not be too difficult to alter this behavior via macro manipulation to meet your exact needs.
For example, boost::serialization
check the config.hpp
and see how you can control it.