pb with project wizard for DLL (VS6 / VS .NET 2003)
-
Hi, I'm trying to follow the example described at http://www.codeproject.com/dll/XDllPt1.asp to create and use the contents of a DLL from a VC++ application. Problem is that i'm using Visual Studio .NET 2003 instead of Visual Studio 6 in the example. It seems my project wizard does not have the "Win32 Dynamic Link Library" option. The only kind of project that look like a DLL is named "MFC DLL" and has 3 possible options. 2 of them create an instance of a class that derives from CWinApp and I guess I don't want that. The last option creates a project with a DllMain entry point (just like the example) but there are also some differences (see cpp file below). So I'm wondering if I can get VS .NET 2003 to behave as VS 6 does (something I didn't see in the project wizard or in the installation setup) or if I must go on using the provided template (meaning there are some good reasons why the template file for a dll has changed in VS .NET 2003). Thanks for your help. cpp template file : #include "stdafx.h" #include #ifdef _DEBUG #define new DEBUG_NEW #endif static AFX_EXTENSION_MODULE testdll02DLL = { NULL, NULL }; extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { // Remove this if you use lpReserved UNREFERENCED_PARAMETER(lpReserved); if (dwReason == DLL_PROCESS_ATTACH) { TRACE0("testdll02.DLL Initializing!\n"); // Extension DLL one-time initialization if (!AfxInitExtensionModule(testdll02DLL, hInstance)) return 0; // Insert this DLL into the resource chain // NOTE: If this Extension DLL is being implicitly linked to by // an MFC Regular DLL (such as an ActiveX Control) // instead of an MFC application, then you will want to // remove this line from DllMain and put it in a separate // function exported from this Extension DLL. The Regular DLL // that uses this Extension DLL should then explicitly call that // function to initialize this Extension DLL. Otherwise, // the CDynLinkLibrary object will not be attached to the // Regular DLL's resource chain, and serious problems will // result. new CDynLinkLibrary(testdll02DLL); } else if (dwReason == DLL_PROCESS_DETACH) { TRACE0("testdll02.DLL Terminating!\n"); // Terminate the library before destructors are called AfxTermExtensionModule(testdll02DLL); } return 1; // ok }