Hello everyone,
i experienced the following very strange behavior/difference in Visual Studio 2003 and 2010:
Two seperate projects will be created in VS2003. One of them is build as a MFC extension DLL (named MFC_Extension_DLL) and the other one is build as a MFC DLL (named MFC_USINGDLL). They will be created in two seperate application instances of Visual Studio 2003.
Inside of the MFC_Extension_DLL, a file called MyClass.h and another one called MyClass.cpp will be created. In those two files, respectively the appropriate declaration of the class and the definitions of the member functions will be written down. Within the Header file, AFX_EXT_CLASS is used to tell the compiler, that the class has to be exported.
Inside of the MFC_USINGDLL, the MyClass.h file will be included directly from inside of the project directory of the MFC_Extension_DLL. Thanks to the AFX_EXT_CLASS macro, the compiler knows at this point it has to import the class here. Now in any method, the MyClass class will be instantiated and one of the public methods will be called.
So far so good, the linker does not work => unresolved external symbol. Everything ok.
Now, in the opened solution of the MFC_USINGDLL, the MFC_Extension_DLL project will be added. Still nothing works.
But now, in the project dependencies of the MFC_USINGDLL, a dependency to the MFC_Extension_DLL will be added.
WTF? The linker runs greatly... and this without any statically linking to the required import library MFC_Extension_DLL.lib!
One last test: I perform exactly the same steps in VS2010. Despite the project dependency, the linker stops because of the unresolved member function.
Please, could somebody explain me this?
Yours sincerely,
Allgaeuer