forum-msg-id-128228-edit

Original date:2015-06-02 20:56:01 Edited by: Icy_Viking Subject: Euphoria Wrapper Problem

Hello,

I am having the following issue while trying to make an example program. The error says bad routine number (-1).

--Example program 
without warning 
 
include std/machine.e 
include std/filesys.e 
--include std/misc.e 
 
include EuSDL2.ew 
include EuSDL2TTF.ew 
 
include flags.e 
 
atom dummy 
 
dummy = SDL_Init(SDL_INIT_VIDEO) 
 
if dummy = -1 then 
	puts(1,"Could not initialize SDL2!\n") 
	abort(0) 
end if 
 
dummy = TTF_Init() --error comes from here 
 
atom win = SDL_CreateWindow("Font Win",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,640,480,SDL_WINDOW_SHOWN) 
atom ren = SDL_CreateRenderer(win,-1,SDL_RENDERER_ACCELERATED) 
 
integer run = 1 
atom key = 0 
 
while run = 1 do 
	 
	SDL_PumpEvents() 
	 
	key = SDL_GetKeyboardState(key) 
	 
	if (peek(key+SDL_SCANCODE_ESCAPE) > 0) then 
		run = 0 
	end if 
	 
	SDL_RenderClear(ren) 
	 
	SDL_RenderPresent(ren) 
 
end while 
 
SDL_DestroyWindow(win) 
SDL_DestroyRenderer(ren) 
SDL_Quit() 

//TTF_Font.h 
extern DECLSPEC int SDLCALL TTF_Init(void); 

--Wrapper code 
public constant xTTF_Init = define_c_func(ttf,"TTF_Init",{},C_INT) 
 
public function TTF_Init() 
 
 return c_func(xTTF_Init,{}) 
	 
end function 

I've tried looking at all the different files, but I can't see anything wrong or why it would come up with a bad routine error. Am I declaring something wrong, is the DLL I'm using bad? When I run the wrapper file, which is .ew, it runs fine, no errors or anything. However, when I try to run an actual program using the wrapper, I get the bad routine error. Any help is greatly appericated.

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu