a friend made a delphi dll which i want to use in my asm project. he can give me all the function names and parameters for them. he just gave me the dll.. how to start? i want to call the functions of the dll..

thanks, bye
Posted on 2002-08-06 12:44:11 by NOP-erator
I have no experience with delphi but you should be able to use LoadLibrary and GetProcAddress.
Posted on 2002-08-06 13:01:47 by Kudos
Make an import lib for it or use LoadLibrary/GetProcAddress/FreeLibrary.
Posted on 2002-08-06 13:03:57 by comrade
how to make an import lib for delphi dll?
Posted on 2002-08-06 13:07:33 by NOP-erator
i tried this, but getprocaddress fails, although the function name is ok:

netdll db "netcodedpr.dll", 0
func db "asmtest", 0 ; undocumented.
error1 db "LoadLibrary error!",0
error2 db "GetProcAdress error!",0

RSP dd ?
dllhandle dd ?

invoke LoadLibrary, ADDR netdll
.if eax!=0
mov dllhandle,eax
invoke MessageBox,0,addr error1,addr netdll,0
jmp @F
invoke GetProcAddress, dllhandle, ADDR func
.if eax!=0
mov RSP,eax
invoke MessageBox,0,addr error2,addr netdll,0
jmp @F

push 21653 ; hide
push 13215 ; 0 = this process
call RSP ; call it

invoke MessageBox, NULL, eax, ADDR func, MB_OK
invoke FreeLibrary,dllhandle
invoke ExitProcess, 0 ; cya!
end start

what's the problem here?

Posted on 2002-08-06 13:49:11 by NOP-erator
The DLL can be compiled without runtime library support, or with it... make sure that it's compiled without... otherwise, you'll have to have the packages on your system because the DLL would be linked against it.

Posted on 2002-08-06 23:37:34 by _Shawn
he just forgot about this:

function Client(command,variable: Integer): Pchar;stdcall;export;

that's why it didn't work..

but thanks anyway..

Posted on 2002-08-07 05:55:40 by NOP-erator
i hate delphi!! :grin:
my friend's function should return a pointer to a string inside the dll...we tried nearly everything, asm commands in delphi (lea and stuff), but nothing worked correctly. then,.. just for fun, we tried to return a string (type PChar), i mean, a complete string.. i knew, that this isn't possible actually, cause the return value has to be in eax.. but we tried.. and guess what? it worked!!! i debugged it with softice and saw, that delphi actually returns a pointer! grrr :)

i think asm programmers are too intelligent for such easy things :tongue:

Posted on 2002-08-07 12:13:29 by NOP-erator
PChar actuallly IS a pointer to zero terminated string. It's what you wanted in the first place. Internally delphi uses other string types, perhaps that was your friend's error. Don't blame the tool, but blame yourselves.
Posted on 2002-08-07 13:23:01 by ramzez
lol.. alright.. i should blame my friend.. i never said i'm familiar with delphi.. it's just.. strange :).. (like all other HLL) :)

Posted on 2002-08-07 13:27:09 by NOP-erator