[Vm-dev] Alien/FFI issue with large struct passed as value and how to load vmmaker?
Holger Freyther
holger at freyther.de
Wed Apr 3 14:36:31 UTC 2019
Hi,
Sorry if this sounds ignorant but I am not sure how to do this with Opensmalltalk VM. How do I get a working VMMaker loaded into a Pharo image these days? It was quite simple in the pharo-vm days but now I am not even sure where to start looking?
I want to debug a FFI problem I see with Ben's clang-c bindings. I get a callback from C with three arguments and one of them is of type CXCursor (it needs to be passed on the stack):
struct CXCursor {
int
enum
void *ptr[3];
};
It's represented as FFIExternalStructure subclass: #CXCursor. In the case of the callback the handle is an instance of FFIExternalStructureReferenceHandle with an Alien embedded into it.
I am trying to understand if the bug is on handling the callback when the CXCursor is created or when trying to push it onto the stack when making a call.
The memory on the stack is turned into an Alien. And Alien>>#referenceStructAt:length: doesn't return a ByteArray but the FFIExternalStructureReferenceHandle with the Alien in it.
At the same time I think FFIPlugin>>#ffiPushStructureContentsOf: doesn't seem to deal with FFIExternalStructureReferencehandle (or handle being an Alien).
Or do I chase it from the wrong end?
cheers
holger
More information about the Vm-dev
mailing list