[plt-scheme] _bytes doesn't work as a simple ctype

From: Chihiro Kuraya (rxqvw at yahoo.co.jp)
Date: Tue Jun 14 09:29:55 EDT 2005

Hi,

Eli Barzilay <eli at barzilay.org> wrote:
> > "PLT Foreign Interface Manual" says that _bytes can be used as a
> > simple ctype as well as a custom-type macro.
> 
> It can.
> 
> 
> > But the following code generates an error.
> > 
> > -----------------------------------------------------------------------
> > (let ((ptr (malloc _byte 128))
> >       (data (make-bytes 16 0)))
> >   (ptr-set! _bytes 0 data))
> > -----------------------------------------------------------------------
> 
> You're missing the `ptr' as a first argument to `ptr-set!'.

Sorry, I just mistyped.
My actual code includes ptr, but the result was the same.


> > The error message displayed in DrScheme is:
> > 
> > -----------------------------------------------------------------------
> > procedure application: expected procedure, given: #f; 
> > arguments were: #<struct:fun-syntax> #<syntax:22:12>
> > -----------------------------------------------------------------------
> 
> Seems like a DrScheme bug.  In the meanwhile, you can use it in a
> `module' definition and it should work fine.

It went well, thank you.


> > This may be _bytes are considered as a custom-type macro.
> 
> No.

I get it.


> > [...] I think it is more convenient to separate a simple ctype from
> > custom-type macro as separate symbols.
> 
> This is an unrelated issue.  I've spent some time thinking of the
> names and couldn't come up with any reasonable set.  If you have any
> suggestions, tell me.  (But they'd have to be good to switch at this
> stage.)

Well ...
Surely difficult to make new names.


Chihiro Kuraya
__________________________________
Save the earth
http://pr.mail.yahoo.co.jp/ondanka/



Posted on the users mailing list.