Manually create cpointer value in racket?

32 views
Skip to first unread message

Nathaniel Griswold

unread,
Oct 7, 2020, 11:28:49 AM10/7/20
to racket users
Related to a question I asked earlier, but this time at the racket side:

Is there any way to manually construct a cpointer with a raw pointer value? I suppose this would mean being able to construct a chez record in racket.

My use case is that I have a remote process talking to a racket process, it is sending a pointer to some shared memory and I want to access that shared memory. It’s an array of c structs with some integer data and each has a pointer to some raw bytes.

Any way to do it?

Thanks

Nathaniel Griswold

unread,
Oct 7, 2020, 11:38:33 AM10/7/20
to racket users
And by “remote process” I just mean a separate process, the parent is sending it to the child.

> On Oct 7, 2020, at 10:28 AM, Nathaniel Griswold <nategr...@gmail.com> wrote:
>
> Related to a question I asked earlier, but this time at the racket side:

Matthew Flatt

unread,
Oct 7, 2020, 5:08:09 PM10/7/20
to Nathaniel Griswold, racket users
Probably you want to use `cast`. If you have an integer `addr` that
corresponds to an address, then

(cast addr _uintptr _pointer)

casts it to a C pointer.

Matthew
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CDC4A5DF-6BE1-4B96-BF3A-0B19F2EB
> F0AC%40gmail.com.

Nathaniel Griswold

unread,
Oct 7, 2020, 5:35:26 PM10/7/20
to Matthew Flatt, racket users
Ah, that’s perfect thanks. Totally missed the miscellaneous support section.

> On Oct 7, 2020, at 4:08 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:
>
> Probably you want to use `cast`. If you have an integer `addr` that
Reply all
Reply to author
Forward
0 new messages