Hi Everybody, I have a winforms application in which I load a regular MFC dll. Even before the InitInstance is called on the dll, there is a crash. If I select "Ignore" on the crash the dll loads successfully and there is no problem in using all of its exported functions. If I select "Retry", a CLR DllNotFound exception is thrown. If I debug from the C++ code and select "Retry", the stack shows that AfxWinInit is called in which the SetCurrentHandles() crashes on the second assert.
void CWinApp::SetCurrentHandles() { ASSERT(this == afxCurrentWinApp); ASSERT(afxCurrentAppName == NULL); // Crashes here . . } On C# side, I call the exported function as follows: [DllImport("WaferMngr.dll")] private static extern void TestFunction(); Thank you in advance. Aman. =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with C# November 29 - December 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com