While this method certainly works, it is obscure, and may cause maintenance problems later on. I prefer to make explicit the definition of TEST_EXPORTS
. I do this by deleting /D "TEST_EXPORTS" from the Project Options, and then changing Test.cpp to define TEST_EXPORTS
:















Notice that the #define TEST_EXPORTS
is before the line #include "Test.h"
, so that the definition will be seen in the include file. Now Test.dll compiles just as before, and you will have a DLL that can be called from other VC++ applications.
文章出处:http://www.codeproject.com/dll/XDllPt1.asp