Re: Eu->dll on Windows, can't get it to work
- Posted by ghaberek (admin) Jun 01, 2016
- 1132 views
AndySerpa said...
Is this just broken or is there some trick to it that I've forgotten?
Compiling with GCC will produce CDECL code. Add a "+" to the name of your function, like this:
constant my_func_id = define_c_func( my_dll, "+my_func", {C_POINTER,C_INT}, C_INT )
Read more here: define_c_func.
said...
On Windows, you can add a '+' character as a prefix to the function name. This indicates to Euphoria that the function uses the cdecl calling convention. By default, Euphoria assumes that C routines accept the stdcall convention.
What the manual doesn't tell you, and it's a really neat trick, is that it will safely ignore that leading "+" character on other platforms, so you don't need to have all sorts of silly ifdefs in your code for Windows or Linux.
-Greg