[plt-scheme] libusb FFI binding

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Mar 5 03:13:21 EST 2007

On Mar  5, Matthew Flatt wrote:
> At Sun, 4 Mar 2007 23:28:43 -0500, Eli Barzilay wrote:
> > On Mar  5, Jakub Piotr C,AE‚(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
> > 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.

(Ugh, I completely missed the fact that this is not some
libusb-specific constant.)

> 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.)

I think that a better approach would be to have some module like the
sgl thing that provides bindings for such common constants.  Maybe
something in the ffi collection?  (Which will make it have

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

Posted on the users mailing list.