
@alomew has joined the channel

Trying to figure out an FFI pointer issue. I have something like so… (define-cstruct _foo [x _int] [y _float])
(define-cpointer-type _foo*)
(define make_foo (_fun -> _foo)) ; <- notice by value return!
(define use_foo (_fun _foo* -> _void)) ; <- notice use by pointer!
The problem I have is I can’t seem to find a function that let’s me take the return value of make_foo
and use it (as a pointer) to the use_foo
function. Surely there’s a simple way to do this? :slightly_smiling_face:

The define-cstruct
for _foo
also defines _foo-pointer
. Use that instead of _foo*
. The Racket-side representation for _foo
and _foo-pointer
is the same, even though they mean different things at the C argument and return level.

Is there a way for me to type alias _foo-pointer
as _foo*
so I don’t have to change a ton of code?

I suppose (define _foo* _foo-pointer)
would work, but want to be sure

FYI, that fixed my issue. TYVM!

Yes, (define _foo* _foo-pointer)
works.