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("my dll.dll");
//if the handle is valid try to call members
if (hModule != IntPtr.Zero)
{
//get the function pointer
IntPtr fptr = GetProcAddres(h Module, "GetInterface") ;
if (fptr != IntPtr.Zero)
{
MyDelg mgi = Marshal.GetDele gateForFunction Pointer(fptr,
typeof(MyDelg)) ;
//here unsure ??
IntPtr ptrModuleInterf ace;
mgi(out ptrModuleInterf ace);
}
FreeLibrary(hMo dule);
Please help me to figure out the proper way to invoke that unmanged
function.
Thank you
Ada@yahoo.com
*** Sent via Developersdex http://www.developersdex.com ***
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("my dll.dll");
//if the handle is valid try to call members
if (hModule != IntPtr.Zero)
{
//get the function pointer
IntPtr fptr = GetProcAddres(h Module, "GetInterface") ;
if (fptr != IntPtr.Zero)
{
MyDelg mgi = Marshal.GetDele gateForFunction Pointer(fptr,
typeof(MyDelg)) ;
//here unsure ??
IntPtr ptrModuleInterf ace;
mgi(out ptrModuleInterf ace);
}
FreeLibrary(hMo dule);
Please help me to figure out the proper way to invoke that unmanged
function.
Thank you
Ada@yahoo.com
*** Sent via Developersdex http://www.developersdex.com ***
Comment