calling a function in a dll

calling a function in a dll

hi,

i want to call a function from a third part dll in my program.i have tried using intefaces but always end up getting a link error.Loadlibrary and getprocaddress both return success values,however the link error persists.Please let me know if there is a different way of calling the function.
--rs

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

If you use LoadLibrary/GetProcAddress, you have to specify a Cray pointer to the dll function:

 
INTERFACE 
   SUBROUTINE DllFoo(... 
END INTERFACE 
POINTER(p_DllFoo, DllFoo) 
... 
p_DllFoo = GetProcAddress(... 

...wait, wait, what do you mean a link error? How can you get link error when calls succeed at run-time? If you mean a run-time error (Access Violation or something), it's probably mismatch in calling convention/arguments. You also have to put appropriate !DEC$ATTRIBUTES STDCALL/C for function name and appropriate !DEC$ATTRIBUTES REFERENCE for arguments if necessary into INTERFACE block.

Jugoslav

Jugoslav
www.xeffort.com

Leave a Comment

Please sign in to add a comment. Not a member? Join today