From: sos AT prospect DOT com DOT ru (Sergey Okhapkin) Subject: RE: dll question 29 May 1998 00:45:32 -0700 Message-ID: <01BD8A77.B3BFBA70.cygnus.gnu-win32@sos> To: "gnu-win32 AT cygnus DOT com" , "'Tim Newsham'" 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: > > > 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: 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 "gnu-win32-request AT cygnus DOT com" with one line of text: "help".