Re: c_proc/func() bug ?
- Posted by Robert Craig <rds at RapidEuphoria.com> Nov 10, 2003
- 630 views
mic _ wrote: > I was playing around with the new ability to use define_c_proc/func and > c_proc/func with machine code functions. What puzzled me a bit was the > order in which arguments are pushed. > > Assume the following: > > foo = define_c_func("", function_pointer, {C_INT,C_INT,C_INT}, C_INT) > result = c_func(foo, {1, 2, 3}) > > Since this uses stdcall, the stack should look like this when the > function is called: > > esp+0: return address > esp+4: 3 > esp+8: 2 > esp+12: 1 > > But what i got was this: > > esp+0: return address > esp+4: 1 > esp+8: 2 > esp+12: 3 > > What gives? In both __cdecl and __stdcall the arguments are pushed in reverse order, i.e. the last argument is pushed first. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com