Re: sdl2 and ffi
- Posted by ChrisB (moderator) Nov 17, 2022
- 2356 views
FAO Andy
Hi
You've defined SDL_surface in SDL_surface.e as a define_c_type, and then
export constant xSDL_GetWindowSurface = define_c_func(sdl,"+SDL_GetWindowSurface",{C_POINTER},SDL_Surface) public function SDL_GetWindowSurface(atom win) return c_func(xSDL_GetWindowSurface,{win}) end function
the function SDL_GetWindowSurface returns a pointer to the SDL_surface, not the actual structure itself, so eu is throwing type errors.
atom surf = SDL_GetWindowSurface(win)
D:\EuProgramming\Euphoria4_1\SDL2Wrapper\Examples\WinImage.exw:28 type_check failure, surf is {7195552,{36'$',{1952061344,{298874067,2684419766,...
So, am I missing a step somewhere?
Cheers
Chris