to create a managed DLL with wrapper functions for my unmanaged
functions. The unmanaged functions come from an unmanaged DLL.
I can successfully build my managed DLL and use it from managed code.
However, at runtime the code cannot find the unmanaged DLL. I've tried
putting the unmanaged DLL in the same directory as the code is running
from, in C:\Windows\Syst em32, and a few other places - no luck, I
always get an error indicating that the unmanaged DLL cannot be found.
Here is what I do in my managed DLL to access functions in the
unmanaged DLL:
using namespace System::Runtime ::InteropServic es;
[DllImport("ADT_ API_L1", EntryPoint="ADT _L1_Initialize" )]
extern "C" unsigned int ADT_L1_Initiali ze(unsigned int dev_num,
char *filename);
The unmanaged DLL is "ADT_API_L1.dll ". In the code for the managed DLL
I also define a namespace and classes with member functions that call
unmanaged functions like "ADT_L1_Initial ize" - I left this out to keep
this as uncluttered as possible.
>From my managed CLR application I include the managed DLL as areference and I can see my namespace, classes, etc. The managed
application compiles without error, but when I run the program it
chokes and dies, giving an error that it cannot load the DLL
(System.DllNotF oundException).
I'm sure there is something simple and stupid that I am missing. Can
anybody here set me straight?