<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        Uh! You can also think about making such a "MyExternalGlobal" (type alias to pointer type) a singleton object. So you could generate #value/#value: on the class-side. And #uniqueInstance. And add a classVar ...<div><br></div><div>Anyway ... <span style="font-size: 13.3333px">How to acquire that "anExternalAddressToVariable". :-D</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Best,</span></div><div><span style="font-size: 13.3333px">Marcel</span></div><div class="mb_sig"></div><blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 17.06.2020 20:08:17 schrieb Marcel Taeumel <marcel.taeumel@hpi.de>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        > <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">All this handling might deserve a specific subclass of ExternalObject, I don't know...</span><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">As long as it is just that #value/#value: on the instance side, a new subclass might not be required. Only if you want to get rid of that #fromHandle:type: call in your bridge code, I would suggest a compilation approach like ExternalStructure class >> #fields...</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Ah! A type alias to the pointer type might be enough:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">MyExternalGlobal class >> #fields</span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">    ^ #(value 'int*') "pointer type of variable type"</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px"><br></span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">externalGlobal := MyExternalGlobal fromHandle: </span></span><span style="font-size: 13.3333px">anExternalAddressToVariable.</span></div><div><span style="font-size: 13.3333px">externalGlobal value "answers external data" at: 1 "see previous example"</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">So, you can then add code manually to improve this access to that global variable. Or change the accessor-generation code to do that ... if it finds a "is global variable" pragma in #fields ... :-D</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Anyway ... t</span><span style="font-size: 13.3333px">he main question remains ... How to acquire that "anExternalAddressToVariable". :-)</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Best,<br>Marcel</span></div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 17.06.2020 19:58:02 schrieb Marcel Taeumel <marcel.taeumel@hpi.de>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        Well, I think you can just use ExternalData and set the #size to 1. ExternalAddress are all reset on image startup. :-)<div><br></div><div>externalGlobal := (ExternalData</div><div>   fromHandle: anExternalAddressToVariable</div><div>   type: pointerTypeOfVariable)</div><div>      size: 1. "Optional."</div><div>...</div><div>value := externalGlobal at: 1.</div><div><br></div><div>The main question is how to acquire that "anExternalAddressToVariable". :-)</div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 17.06.2020 17:34:25 schrieb Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div>I have sketched an application specific answer on SO.<br></div><div>The plugin has minimal support (a primitive) to retrieve the address of a given symbol from a given library.</div><div>Normally, we should create an ExternalData with such address and variable type asPointerType.</div><div>Then we can pass either the variable by reference (just pass the ExternalData) or by value (I don't know who will dereference the address...).</div><div>Of course, those ExternalAddress shall be cleared upon image resumption, etc...</div><div>All this handling might deserve a specific subclass of ExternalObject, I don't know...</div><div>(subclass of ExternalData so as to not have to modify the plugin?)<br></div><div><br></div><div>For HDF5, I'm going to assume that those hid_t never change after HDF5 library initialization, and that such initialisation happens at time of dynamic linking/loading.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 17 juin 2020 à 14:56, Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left: 1px solid rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div><div id="gmail-m_3911528267048549362__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
                                        Hi Nicolas.<div><br></div><div>> <span style="font-family: Arial,Helvetica,sans-serif;font-size: 13px">So what is needed is to get the address of the variable (exactly like we lookup address of a function), then dereference it to get the contents...</span></div><div><span style="font-family: Arial,Helvetica,sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial,Helvetica,sans-serif;font-size: 13px">Since I am in the process of shrinking "Alien-Core" into "FFI-Callback" ... could this be implemented with a new interface to the FFI plugin? Maybe not. Unless you can provide an exported call that the plugin can intercept to copy the address for you? If it is not already exposed in another call. Then it would be easy.</span></div><div><span style="font-family: Arial,Helvetica,sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial,Helvetica,sans-serif;font-size: 13px">Best,</span></div><div><span style="font-family: Arial,Helvetica,sans-serif;font-size: 13px">Marcel</span></div><div></div><blockquote type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 17.06.2020 14:11:14 schrieb Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div>Hi Marcel,</div><div>I'm not so sure.</div><div> It does not look like a constant, but rather a variable.</div><div>The type of this variable is a hid_t, but the content can change at runtime (I believe once at HDF5 initialisation).<br></div><div>So what is needed is to get the address of the variable (exactly like we lookup address of a function), then dereference it to get the contents...<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 17 juin 2020 à 12:52, Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left: 1px solid rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div><div id="gmail-m_3911528267048549362gmail-m_8594618048785622203__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
                                        Hi Nicolas,<div><br></div><div>that's like to already be covered by ExternalPool. :-) I tried to write a lot of documentation on how to use it in the class comment.</div><div><br></div><div>Best,</div><div>Marcel</div><div></div><blockquote type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 17.06.2020 12:50:24 schrieb Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div>Hi all, Marcel,</div><div>yet another basic requirement:</div><div><a href="https://stackoverflow.com/questions/62427197/how-one-refers-to-an-external-global-variable-in-squeak-ffi" target="_blank">https://stackoverflow.com/questions/62427197/how-one-refers-to-an-external-global-variable-in-squeak-ffi</a></div><div><br></div><div>I did not even try to inquire the implementation...<br></div></div>
</div></blockquote>
                                        </div></div><br>
</blockquote></div>
</div></blockquote>
                                        </div></div><br>
</blockquote></div>
</div></blockquote></div></div></blockquote></div></div></blockquote>
                                        </div></body>