Original date:2019-06-02 01:17:52 Edited by: Icy_Viking Subject: Re: Bad Routine Number

ghaberek said...
Icy_Viking said...

Ok, I figured out it was a 32-bit DLL I'm using, so that is correct. However, not I'm not getting the -1 error anymore. However nothing shows up when the basic program is executed. I ran it from the command line as well and no errors are coming up. Could it be the way windows draws windows/graphics? I'm using Windows 7 64-bit Ultimate.

It looks like the SDL routines are using the CDECL calling convention. Euphoria will use the STDCALL convention by default on Windows. Have you prepended the function names with '+' to force CDECL?

This is only necessary on 32-bit Windows (64-bit uses its own single convention). The '+' will be safely ignored on 64-bit Windows and non-Windows systems.


Interesting, I didn't have this problem with 4.0.5, also, no I haven't used the "+" in naming convention. Can you give me a quick example of how it would look like?

EDIT: I figured it out. I was also able to make the window appear. It appears the SDL2 DLL is using the _cdecl format, so you need the '+' in front of the function name. Like so:

public constant xSDL_Init = define_c_func(sdl2,"+SDL_Init",{C_UINT},C_INT) --Notice the '+' right next the function name inside the quotes. 
public function SDL_Init(atom flags) 
 return c_func(xSDL_Init,{flags}) 
end function 
Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu