leif
2017-7-31 17:21:18

@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))


leif
2017-7-31 17:21:33

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


leif
2017-7-31 17:21:59

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


leif
2017-7-31 17:22:28

As shown here:



leif
2017-7-31 17:22:36

If so I’d be happy to fix that.


mflatt
2017-7-31 18:25:38

@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.


leif
2017-7-31 18:35:42

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


bmastenbrook
2017-8-1 00:34:48

Which package provides raco exe?


bmastenbrook
2017-8-1 00:37:37

Answering my own question: compiler-lib