Hello,
I need to load in my C# .nET 2.0 application an dll (not COM)written in
Delphi. The dll has a function which returns a pointer to an IModule
interface defined in that dll.
How do I declare my delegate and call the unmanaged function?
I did something like that;
//here unsure if this should be the signature ??
internal delegate MyDelg (out IntPtr IModule);
IntPtr hModule = LoadLibrary("mydll.dll");
//if the handle is valid try to call members
if (hModule != IntPtr.Zero)
{
//get the function pointer
IntPtr fptr = GetProcAddres(hModule, "GetInterface");
if (fptr != IntPtr.Zero)
{
MyDelg mgi = Marshal.GetDelegateForFunctionPointer(fptr,
typeof(MyDelg));
//here unsure ??
IntPtr ptrModuleInterface;
mgi(out ptrModuleInterface);
}
FreeLibrary(hModule);
Please help me to figure out the proper way to invoke that unmanged
function.
Thank you
Ad*@yahoo.com
*** Sent via Developersdex http://www.developersdex.com ***