racket-sdl icon indicating copy to clipboard operation
racket-sdl copied to clipboard

SDL_AddTimer segfault

Open lockie opened this issue 6 years ago • 0 comments

Hello! I can't figure how to use SDL_AddTimer. The problem seems to be in the callback parameter. When I pass simple lambda, it segfaults:

racket
Welcome to Racket v7.1.
> (require sdl)
> (SDL_Init SDL_INIT_TIMER)
> (SDL_AddTimer 1 (lambda (interval dummy) #f) #f)
SIGSEGV MAPERR si_code 1 fault on addr 0x390
zsh: abort (core dumped)  racket

When I try to pass #f as callback. it segfaults at addr (nil). When I try to convert callback to some other type, racket complains that it expects procedure?.

I'm not fluent in Racket FFI, so the question is how do I correctly pass callback? Am I missing something?

lockie avatar Apr 10 '19 09:04 lockie