Re: c_proc/func() bug ?

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu