Subject: RE: dll question
From: [email-masked] (Sergey Okhapkin)

29 May 1998 00:45:32 -0700
Message-ID: <01BD8A77.B3BFBA70.cygnus.gnu-win32@sos>
To: "[email-masked]" <[email-masked]>,
        "'Tim Newsham'"
	 <[email-masked]>

Tim Newsham wrote:
> This much seems to work properly.  I am having problems, however, when
> I try to actually call one of the procedures.  The stack pointer (esp)
> seems to be incorrect after a call to the procedure.  In particular
> I am passing in 3 4-byte arguments (12 bytes).  The emitted code
> looks like:
> 
>     <push args>
>     call *%ebx
>     addl %0xc, %esp
> 

You have to declare called functions as __stdcall. For example:

int __stdcall (*fptr)(int a, int b, int c);

....
fptr = GetProcAddress(dllhandle, "functionname");
(*fptr)(par1, par2, par3);

This case the emitted code will look like:
<push args>
call *%ebx

Stdcall function removes from stack pushed arguments itself.

-- 
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".