[racket] Bootstrapping an FFI

From: Ian Tegebo (ian.tegebo at gmail.com)
Date: Fri Aug 10 22:43:45 EDT 2012

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:


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


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?

Ian Tegebo

Posted on the users mailing list.