Hi Ian,

unfortunately I can't help you with automatic code generation but i've written a binding for libSDL (and libSDL_image) manually. It's not complete but covers quite a usable part of SDL (video, events, joystick and some more). If it helps you in any way, feel free to use / fork the code. It's on github:

https://github.com/pb82/sdl4racket

On 11.08.2012 04:43, Ian Tegebo wrote:
I'm playing around with an FFI for SDL.  Rather than slog through all
the headers by hand, I went looking for some code that may do a bit of
the parsing and translation.  On PLaneT, I found dherman's c.plt:

http://planet.racket-lang.org/display.ss?package=c.plt&owner=dherman

I got stuck when it appeared that I'd need to provide it with a list
of symbols that were typedef-ed:

http://planet.racket-lang.org/package-source/dherman/c.plt/4/0/planet-docs/c/parsing.html#(part._include)

I bit of preprocessing seems to make this still quite a bit of work:

gcc  -D "__extension__=" -D "__attribute__(ARGS)=" -E
/usr/include/SDL/SDL.h  | sed '/^\#/d' | indent -st -i2 |grep -vE
'^[[:space:]]*$' > sdl.h

Has anyone else gone down this road before?  Also, Besides Eli's
paper, any general advice for Racket FFIs?

Thanks,


____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to