Jazz Jazz - 1 month ago 21
C++ Question

Export all symbols when creating a DLL

With VS2005, I want to create a DLL and automatically export all symbols without adding __declspec(dllexport) everywhere and without hand-creating .def files. Is threre a way to do this?

Answer

It can be done...

The way we do it here is to use the /DEF option of the linker to pass a "module definition file" containing a list of our exports. I see from your question that you know about these files. However, we do not do it by hand. The list of exports itself is created by the dumpbin /LINKERMEMBER command, and manipulating the output via a simple script to the format of a module definition file.

It is a lot of work to setup, but it allows us to compile code created without dllexport declarations for Unix on Windows.