Awesome, thanks!

I actually just implemented it with the roundabout callback system, i think
i might try out your suggestion though.

Thanks for working on racket!

Nate


On Mon, Jul 13, 2020 at 12:20 PM Matthew Flatt <mfl...@cs.utah.edu> wrote:

> I see that there's not a good way right now, but here's a workaround
> that uses information about the current layout:
>
> A cpointer value is implemented as a Chez Scheme record with either 1
> field or 2 fields. There are 2 fields only when the cpointer has an
> offset as a result of `ptr-add`, so you can probably ignore that.
>
> To extract the first field, assume that a record has the same layout as
> a vector, so use `Svector_ref(p, 0)` to extra the field from the
> cpointer `p`.
>
> Then you can use `Sunsigned_value()` to convert that field value to a
> pointer-sized integer, then case.
>
> I might have some part of that wrong, but it should be close... Of
> course, there should be better support for record-field access and
> cpointer extraction, so I'll add to the API.
>
>
> At Mon, 13 Jul 2020 11:43:35 -0500, Nate Griswold wrote:
> > I had a question. In embedded racket, I am passing a _cpointer value back
> > to c code by way of racket_apply's return value.
> >
> > Looking over https://docs.racket-lang.org/inside/cs-values_types.html ,
> > there appears to be a group of functions associated with extracting
> values
> > from ptrs. I do not see one for a pointer ptr there.
> >
> > Is there a way to get at a returned _cpointer value from c code?
> >
> > Thanks
> >
> > Nate
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to racket-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/racket-users/CAM-xLPrKGgAgii7BjyfvCs6i0BmbMp0
> > yoo09UoUF0nqVzX_CXQ%40mail.gmail.com.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPrQ8Qv66eFRMuorqO%2BwqzutnPQVgZ79sPNjxKAgnij7CA%40mail.gmail.com.

Reply via email to