1. zlib entry point inflateReset2 Error

Hello all,

As I am trying to wrap the SDL_Image library for SDL2, I keep getting the error described in the title. It only seems to happen when I call the IMG_Init or any of the IMG functions from the SDL_image library. I tried replacing zlib.DLL with different ones, but I still keep getting the error. I'm assuming since it only happens when one of the IMG functions is called, it has to do something with the SDL_image library.

--Wrapper Code 
public constant IMG_INIT_JPG = 1, 
				IMG_INIT_PNG = 2, 
				IMG_INIT_TIF = 4, 
				IMG_INIT_WEBP = 8 
 
public constant xIMG_Init = define_c_func(img,"+IMG_Init",{C_INT},C_INT) 
 
public function IMG_Init(atom flags) 
 
 return c_func(xIMG_Init,{flags}) 
	 
end function 
 
public constant xIMG_Load_RW = define_c_func(img,"+IMG_Load_RW",{C_POINTER,C_INT},C_POINTER), 
				xIMG_Load = define_c_func(img,"+IMG_Load",{C_POINTER},C_POINTER) 
				 
public function IMG_Load_RW(atom src,atom xfree) 
 
 return c_func(xIMG_Load_RW,{src,xfree}) 
	 
end function 
 
public function IMG_Load(sequence file) 
 
 --atom str = allocate_string(file,1) 
  
 --return c_func(xIMG_Load,{str}) 
 
 return IMG_Load_RW(SDL_RWFromFile(file,"rb"),1) 
	 
end function 
without warning 
 
include std/machine.e 
include std/math.e 
 
include EuSDL2.ew 
include EuSDLImg.ew 
 
include flags.e 
 
if SDL_Init(SDL_INIT_VIDEO) = -1 then 
	puts(1,"Failed to init SDL!\n") 
	abort(0) 
end if 
 
atom win = SDL_CreateWindow("Image Example",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,640,480,SDL_WINDOW_SHOWN) 
atom ren = SDL_CreateRenderer(win,-1,SDL_RENDERER_ACCELERATED) 
 
atom run = 1 
atom key = 0 
 
integer img_flag = or_all({IMG_INIT_PNG}) 
 
if IMG_Init(img_flag) = -1 then --Zlib DLL error gets called when this is called 
	puts(1,"Failed to init SDL_Image!\n") 
	abort(0) 
end if 
 
atom h = IMG_Load("sphere-04.png") -- Same for this function 
atom tex = SDL_CreateTextureFromSurface(ren,h) 
 
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_RenderCopy(ren,tex,0,0) 
	 
	SDL_RenderPresent(ren) 
	 
end while 
 
SDL_DestroyWindow(win) 
SDL_DestroyRenderer(ren) 
 
IMG_Quit() 
 
SDL_Quit() 
new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu