This code work for me on macOS from the command line. It does not work
in DrRacket, and that's because an async callback is not allowed to do
anything that has to synchronize with a Racket thread. DrRacket's
output requires thread synchronization, while it happens that stdout in
a terminal usually doesn't have to synchronize. In short, don't use
ports in an async callback.
Try using `log-error` instead of `displayln`, since it's safe to log a
message in an async callback. If I make that change, I see logging when
running in DrRacket --- but also a crash soon after, because nothing
keeps the callback live.
Changing to
(define callback
(lambda (interval dummy)
(log-error "in callback") ;; never gets called
1000))
(SDL_AddTimer
1000
callback
#f)
keeps the callback live and avoids a crash.
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
racket-users...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/racket-users/0cc49a07-c070-4636-8901-a13ae5a4
> 7e6d%
40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.