Bad Routine Number

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

Hello,

So I recently went to check my SDL wrapper while using the new Euphoria 4.1.0 Beta 2 and noticed that I get a bad routine number -1 when trying to run a example program. This did not happen using 4.0.5.

--Wrapper Code 
atom sdl2 
 
ifdef WIN32 then 
  sdl2 = open_dll("SDL2.dll") 
 elsifdef LINUX or FREEBSD then 
  sdl2 = open_dll("SDL2.so") 
end ifdef 
 
if sdl2 = -1 then 
	puts(1,"Failed to load SDL2.dll!\n") 
	abort(0) 
end if 
 
public constant xSDL_Init = define_c_func(sdl2,"SDL_Init",{C_UINT},C_INT) 
 
public function SDL_Init(atom flags) 
 
 return c_func(xSDL_Init,{flags}) 
	 
end function 
--Sample Program 
 
include std/machine.e 
include EuSDL2.ew 
include flags.e 
 
atom width = 640, height = 480 
 
--Init SDL2 
if SDL_Init(SDL_INIT_EVERYTHING) = -1 then --Error appears to be coming from here (This worked fine in 4.0.5) 
	puts(1,"Could not init SDL2!\n") 
	abort(0) 
end if 
 
--Window creation 
atom win = SDL_CreateWindow("Basic Window - Will close after 3 Seconds",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,width,height,SDL_WINDOW_SHOWN) 
 
if win = -1 then 
	puts(1,"Failed to create window!\n") 
	abort(0) 
end if 
 
SDL_Delay(3000) -- make the window appear for three seconds 
 
--Cleanup 
SDL_DestroyWindow(win)  
 
SDL_Quit() 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu