[plt-scheme] libusb FFI binding

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Mar 4 23:28:43 EST 2007

On Mar  5, Jakub Piotr C$,1 b(Bapa wrote:
> [...]
> Btw. apropos FFI:
> 1. PATH_MAX (and maybe some other C constants) could be exported in 
> %foreign. It would make the bindings more bullet proof.

These are usually defined as preprocessor constants -- so these
constants don't really exist.  Having them requires parsing the source

> 2. _enum could be more flexible. Currently there is no way to get a
> number corresponding to a symbol... Maybe allow for expressions
> evaluated with unhygienically added _enum symbols binded to
> corresponding numbers. I wanted to pass numbers instead of symbols
> (for custom request codes) and had to make a new ctype. Expressions
> evaled on function call with enum symbols bound would solve this
> problem (and some other too).

There are of course lots of ways to implement enumerations...  In some
situations you may want to have a more efficient hash tables, you
could want to have proper bindings (use (logior foo bar) instead of
'(foo bar)) etc etc.  The foreign interface can't cover all of them,
so instead it's making it easy to implement your own types.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.