Export all symbols when creating a DLL

Jazz picture Jazz · Oct 22, 2008 · Viewed 67.3k times · Source

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

Andrew Stein picture Andrew Stein · Oct 22, 2008

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.