How do i get return values from a function within a dll file i made ?
Simple. return values are placed in eax, when your DLL function finishes, place the return value in eax, it should still be there, when it returns to your calling application.
umbongo
But if i want to get more than 1 parameter ?
Make one of the inputs to the function a pointer to the return structure!
Mirno
If you just want some low number of return values, pass the addresses of where they should be stored to your dll, then the dll can set the data. This is byref parameter passing.
.data
Thing1 DW 0
Thing2 DW 0
.code
invoke MyDLL, ADDR Thing1, ADDR Thing2
...
(inside the dll)
MyDll PROC pThing1:DWORD, pThing1:DWORD
mov ecx, pThing1
mov eax, 5 ; dummy return data
mov , eax
mov ecx, pThing2
mov eax, 10 ; dummy return data
mov , eax
mov eax, 0 ; eax = 0 usually means a good ending
ret
MyDll ENDP
And yes, if you have lots and lots of parameters to pass back and fourth, make a structure and pass the address of the structure.