
@mflatt The FFI docs have the following pseudocode for malloc: (let ([p (malloc from-type)])
(ptr-set! p from-type v)
(ptr-ref p to-type))

Errr….cast, they have the pseudocode for cast.

But in this example, shouldn’t the malloc
be apointer, given tht ptr-set!
and ptr-ref
are happening to it?

As shown here:


If so I’d be happy to fix that.

@leif I’m not sure what you mean, and I think that code is right. (It’s the actual implementation in the simple case, as reflected by the convert
helper function.) malloc
does return a pointer, but the pointer refers to from-type
content, where from-type
isn’t isn’t necessarily a pointer type. Similarly, pre-set!
and ptr-ref
want a pointer to a from-type
/to-type
to cast between those.

@mflatt Ah, right, okay, that makes sense. Thanks.

Which package provides raco exe
?

Answering my own question: compiler-lib