[plt-scheme] Eli Barzilay's new FFI stuff

From: Christopher Armstrong (radeex at gmail.com)
Date: Sun Aug 8 13:28:07 EDT 2004

On Sat, 7 Aug 2004 21:42:52 -0400, Christopher Armstrong
<radeex at gmail.com> wrote:
> On Sat, 7 Aug 2004 21:22:06 -0400, Eli Barzilay <eli at barzilay.org> wrote:
> > On Aug  7, Christopher Armstrong wrote:
> > > On Sat, 7 Aug 2004 19:22:54 -0400, Eli Barzilay <eli at barzilay.org> wrote:
> > > > You can convert the whole struct to a byte string (which doesn't add
> > > > any overhead), then look in that string beyond the header.  I'll need
> > > > to see if there is any other way to do this.
> > >
> > > :-( Well, it'll have to do for now. Hmm, I'm getting some error about
> > > "undefined identifier: type:" when I try to use (ptr-ref the-string
> > > (_bytes o N)) for this purpose. Is that a bug in the _bytes macro?
> >
> > The (_bytes ...) macro is something that should be used only in a
> > (_fun ...) construct.  You should use _bytes instead.
> Really? But that segfaults... How will it know how many bytes to grab?

Sorry, Eli, you don't have to worry about this any more. There's
already a C function defined that extracts the value of the string,
and that + make-sized-byte-string did the trick for me. So support
isn't necessary for my use case any more, although it still seems
kinda sucky that the FFI can't extract it itself.

Anyway, thanks a lot for the help you've given me, and I'm sorry for
bugging you so much ;-) All of my *major* problems have been solved,
and I can continue hacking on my stuff (except for that extra-copying
that's necessary for the super-struct-fields, but that's not a
show-stopper yet). You've been a great help. :-)

 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+            http://radix.twistedmatrix.com

Posted on the users mailing list.