alomew
2020-1-17 13:49:17

@alomew has joined the channel


massung
2020-1-17 16:02:30

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:


mflatt
2020-1-17 16:09:06

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.


massung
2020-1-17 16:10:43

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


massung
2020-1-17 16:11:22

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


massung
2020-1-17 16:21:01

FYI, that fixed my issue. TYVM!


mflatt
2020-1-17 16:25:08

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