Re: Callback problem
- Posted by stabmaster_ at hotmail.com Oct 13, 2002
- 353 views
>This sounds like the cdecl-stdcall problem. >... >There probably is a way to fix it by poking assembly. > >Karl Bochert I did just that in Glue, my GLUT wrapper for Euphoria. In glue.e there is a function called cdecl_callback that takes a routine_id and a sequence of parameter sizes (in bytes). E.g. if you have a function foo that takes 3 integer parameters, you'd do something like: atom my_callback my_callback = cdecl_callback(routine_id("foo"),{4,4,4,4}) Note that i passed 4 4's, this is intentionally. You see, there's a small problem: Since EIP is pushed on the stack after the parameters, you'll get the return address in the first parameter of your function. To get around this you must prepend a dummy argument to your function. I.e. if you had: function foo(integer a,integer b,integer c) You'd have to change it to: function foo(integer dummy,integer a,integer b,integer b)