<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 3 Apr 2019 at 22:54, Holger Freyther <<a href="mailto:holger@freyther.de">holger@freyther.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br>
Hi,<br>
<br>
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?<br></blockquote><div><br></div><div>You haven't said what you've tried.  This looks updated recently... <a href="http://wiki.squeak.org/squeak/vmmaker">http://wiki.squeak.org/squeak/vmmaker</a></div><div><br></div><div>btw, I see an experimental git repo for VMMaker ...</div><div>   <a href="https://github.com/feenkcom/opensmalltalk-vm/tree/pullrequest4/vmmaker/smalltalksrc/VMMaker">https://github.com/feenkcom/opensmalltalk-vm/tree/pullrequest4/vmmaker/smalltalksrc/VMMaker</a> </div><div>but this is not what the production VMs are built from. <br></div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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):<br></blockquote><div><br></div><div>You are referring this page then...?  </div><div>   <a href="https://blog.openinworld.com/2016/09/pharo-libclang-ffi-part-4-ast-walking-with-visitors-callbacks/">https://blog.openinworld.com/2016/09/pharo-libclang-ffi-part-4-ast-walking-with-visitors-callbacks/</a>  <br></div><div>Which part of it are you up to?</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">struct CXCursor {<br>
        int<br>
        enum<br>
        void *ptr[3];<br>
};<br>
<br>
It's represented as FFIExternalStructure subclass: #CXCursor. </blockquote><div><br></div><div>For more context for interested readers, CxCursor definition is shown here...</div><div><a href="https://blog.openinworld.com/2016/09/pharo-libclang-ffi-part-3-loading-an-ast/">https://blog.openinworld.com/2016/09/pharo-libclang-ffi-part-3-loading-an-ast/</a>  <br></div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In the case of the callback the handle is an instance of FFIExternalStructureReferenceHandle with an Alien embedded into it.<br></blockquote><div><br></div><div>Wow, those posts were back in 2016. How time flies. Its vague, but I don't remember ever seeing class FFIExternalStructureReferenceHandle or Alien anywhere.</div><div>I'll have to freshly re-follow the posts myself to review.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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.<br>
<br>
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.<br>
<br>
At the same time I think FFIPlugin>>#ffiPushStructureContentsOf: doesn't seem to deal with FFIExternalStructureReferencehandle (or handle being an Alien).<br></blockquote><div><br></div><div>I'm not familiar with that part of it.  Hopefully someone else can chime in.<br></div><div>btw, did you do the whole series of post individually, or bulk load the code from... <a href="http://smalltalkhub.com/#!/~BenComan/LibclangPractice">http://smalltalkhub.com/#!/~BenComan/LibclangPractice</a></div><div><br></div><div>cheers -ben</div><div> </div></div></div>