I inherited a huge C++ multi-project solution with many dynamic libraries but without any
__declspec(dllexport)
I learned that one does not necessarily have to insert any dllexport (would be much work) but that one can use a .def file in addition to corresponding .dll instead.
In order to try that I built a "DLL Hello World" project from here, removed the dllexport from the header and...failed desperately. In the words of already cited page, my key question is how to
"[..] use the .def file when building the DLL."
My .def file is (I try the code only with the Add method):
LIBRARY MathFuncsDll
EXPORTS
?Add@MyMathFuncs@MathFuncs@@SANNN@Z
How do I use it when building the DLL in Visual Studio 2010 in order to export the Add method?
Addfunction? - cdarkestatic double Add(double a, double b);, placed aspublicin classMyMathFuncsof namespaceMathFuncs- FinnfalterGetWindowText()is an example of a "pure C interface" function exported from a DLL. You useextern "C", you don't use C++ objects at the interface, you don't throw C++ exceptions outside the function, etc. (The implementation can be in C++, but the interface is pure C.) But it seems you want to export a C++ class (static) method... - Mr.C64