DLL import problem
-
Hi All, I am a newbie for C# currently working on a porting project. I need to port and use a VC++ (6.0) MFC extesion DLL methods in C# (8.0) application. To do that, I created a managed wrapper dll (MFC Regular DLL shared with /CLR turned ON) from C# and referred the MFC extension DLL from it. But when i call the interface function written in the wrapper DLL from the C# application, I am getting the below error. "Unable to load DLL 'TestWrapper.dll': Invalid access to memory location. (Exception from HRESULT: 0x800703E6)" This error occurs only when i add the MFC extension DLL as the dependency to the wrapper dll. If the remove that dependency 'TestWrapper.dll' loads successfully. Note: All DLLs and C# application is in the same path. Problem happens in Windows XP SP3. Any help is appreciated. Thanks in advance.
Selva
-
Hi All, I am a newbie for C# currently working on a porting project. I need to port and use a VC++ (6.0) MFC extesion DLL methods in C# (8.0) application. To do that, I created a managed wrapper dll (MFC Regular DLL shared with /CLR turned ON) from C# and referred the MFC extension DLL from it. But when i call the interface function written in the wrapper DLL from the C# application, I am getting the below error. "Unable to load DLL 'TestWrapper.dll': Invalid access to memory location. (Exception from HRESULT: 0x800703E6)" This error occurs only when i add the MFC extension DLL as the dependency to the wrapper dll. If the remove that dependency 'TestWrapper.dll' loads successfully. Note: All DLLs and C# application is in the same path. Problem happens in Windows XP SP3. Any help is appreciated. Thanks in advance.
Selva
native code DLLs are located by Windows searching the folders listed in the PATH environment variable. Unless PATH contains a simple "." entry, putting the native DLL in your EXE's folder is insufficient. FWIW: when the native DLL calls on other DLLs, the same rules apply, and whatever DLL isn't found the error message will always be the same. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
-
native code DLLs are located by Windows searching the folders listed in the PATH environment variable. Unless PATH contains a simple "." entry, putting the native DLL in your EXE's folder is insufficient. FWIW: when the native DLL calls on other DLLs, the same rules apply, and whatever DLL isn't found the error message will always be the same. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
Hi Luc, Thanks for you reply. But my problem was a little different. I had a few thread local variable declarations in the MFC DLL which caused problem while loading at runtime. Now working on it to change the implementation of the variable. Thanks again.
Selva