Problem loading .DLL in C++/CLI

Started by
3 comments, last by Red_falcon 17 years, 8 months ago
Hi all, Im trying to write a C++/CLI wrapper to load an unmanaged .DLL i've written a while back in C++ for my D3D renderer. I have a static .lib file which is linked to the project, this library contains a function "CreateDevice(...)" that takes a string parameter to load the specific game engine renderer (right now just D3DRenderer.dll) Works all fine and dandy with C++, however when using C++/CLI i get to the line hDLL = LoadLibrary("D3DRenderer.dll"); And it doesn't work - just keeps the value of hDLL as "undefined" I have put the .dll in all directories of the solution so i don't see how it could be an issue of not being found... Is there something special I need to do to load a .DLL file using LoadLibrary with C++/CLI?? Any help would be much appreciated.
Advertisement
Perferati,

The library should be in the directory that contains your executable. If its still failing, try running this to see what error message is being returned.

-brad
-brad
Quote:Original post by Galapaegos
Perferati,

The library should be in the directory that contains your executable. If its still failing, try running this to see what error message is being returned.

-brad


I put the .dll in every possible directory it could search, loads it fine now :-)

I will use process of elimination to find the right directory.

PS: Im still having issues loading the .DLL though (see Access Violation ... post)
What's the error you get

GetLastError();
MCO
Try the key words #pragma unmanaged and #pragma unmanaged. I also loaded my unmanaged .dll with the keyword using
-----"Master! Apprentice! Heartborne, 7th Seeker Warrior! Disciple! In me the Wishmaster..." Wishmaster - Nightwish

This topic is closed to new replies.

Advertisement