Binding a single function symbol with [foreign]

Jorn Vernee jbvernee at
Fri Sep 7 12:49:01 UTC 2018

> I guess the `LayoutType` of a returned `Pointer` would be
> `LayoutType.ofVoid` before the cast? Or is there a generic fall-back
> carrier type? Maybe a direct `ByteBuffer` that wraps the returned
> pointer, and uses spill-to-heap for non-pointer returns?

Never mind, that would create asymmetrical behaviour; remove an 
indirection if the return type is a Pointer, but not do so otherwise.

Still, just copying whatever the result is into a ByteBuffer might be a 
good default? It's not a _great_ default, because of the copy, but for 
ad-hoc usage it might be good enough? You could always get rid of the 
copy by explicitly supplying a carrier type.


More information about the panama-dev mailing list