[plt-scheme] libusb FFI binding

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 5 01:35:32 EST 2007

At Sun, 4 Mar 2007 23:28:43 -0500, Eli Barzilay wrote:
> On Mar  5, Jakub Piotr Cłapa 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
> files.

I think that's the point. Getting an arbitrary constant is not possible
via the FFI. But since `#%foreign' is implemented in C, `#%foreign'
could easily report the value of a few specific constants, including
PATH_MAX. 

I'm not sure which constants would be useful, but PATH_MAX and
FILENAME_MAX seem like good candidates. (Beware that PATH_MAX is not
actually standard.)

Matthew



Posted on the users mailing list.