<div><div dir="auto">My best guess is that since apicall is windows-only, it is ignored by the FFI on Linux so the library install code doesn’t even bother to patch it. All other platforms use cdecl, windows uses both (the details really don’t matter for just using FFI, but if you’re interested, look up Pascal-style vs C-style calling conventions, in particular regarding argument popping in caller vs callee).</div></div><div dir="auto"><br></div><div dir="auto">Besides, you were saying it did work, right?</div><div dir="auto"><br></div><div dir="auto">- Vanessa -</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun 10. May 2020 at 09:08, gettimothy via Squeak-dev <<a href="mailto:squeak-dev@lists.squeakfoundation.org">squeak-dev@lists.squeakfoundation.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u><div><div style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10pt"><div>Thanks all.<br></div><div><br></div><div>TL;DR "none" of the OpenGL KeyWord API methods are being cdecled, they are all <apicall in the bytecodes and decompile.<br></div><div><br></div><div><br></div><div>preludes:<br></div><div><br></div><div>1. I am able to compile and run a Hello Triangle from <a href="http://antongerdelan.net/opengl/hellotriangle.html" target="_blank">http://antongerdelan.net/opengl/hellotriangle.html</a>  so basic library stuff is there on Linux64<br></div><div><br></div><div>2. Squeak is :<br></div><blockquote style="border:1px solid rgb(204,204,204);padding:7px;background-color:rgb(245,245,245)"><div><div>/home/wm/usr/src/smalltalk/squeak6.0alpha/shared/Squeak6.0alpha-19537-64bit.image<br></div><div>Squeak6.0alpha<br></div><div>latest update: #19634<br></div><div>Current Change Set: OpenGL<br></div><div>Image format 68021 (64 bit)<br></div><div><br></div></div></blockquote><div><br></div><div>Examining the source under the "decompile" option:<br></div><div><br></div><div><br></div><blockquote style="border:1px solid rgb(204,204,204);padding:7px;background-color:rgb(245,245,245)"><div><div>glPixelStorei: pname with: param <br></div><div><apicall: void 'glPixelStorei' (ulong long) module: 'libGL.so.1'><br></div><div>^ self externalCallFailed<br></div></div></blockquote><div><br><br>which shows that the source code string in my original question, is being replaced.<br><br>Here is that "source" view again:</div><div><br></div><blockquote style="border:1px solid rgb(204,204,204);padding:7px;background-color:rgb(245,245,245)"><div><div>glPixelStorei: pname with: param<br></div><div>"This method was automatically generated."<br></div><div>"void glPixelStorei(GLenum pname, GLint param);"<br></div><div><apicall: void 'glPixelStorei' (ulong long) module: '#openGLLibraryName'><br></div><div>^self externalCallFailed<br></div></div></blockquote><div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">You will notice that the <apicall: has not been replaced with the <cdecl:<br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">That failure is true on both decompile and byteCodes:<br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div></div><blockquote style="border:1px solid rgb(204,204,204);padding:7px;background-color:rgb(245,245,245)"><div><div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><apicall: void 'glPixelStorei' (ulong long) module: 'libGL.so.1'><br></div></div><div>41 <F8 78 00> callPrimitive: 120<br></div><div>44 <4C> self<br></div><div>45 <81> send: externalCallFailed<br></div><div>46 <5C> returnTop<br></div><div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div></div></div></blockquote><div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">it is true for all the methods of  a quick scan in Keyword API category.<br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">verifying that the cdecl is wrong, I look in FFITestLibrary ffiPrintString:<br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">and there is a correct looking cdecl.<br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div></div><blockquote style="border:1px solid rgb(204,204,204);padding:7px;background-color:rgb(245,245,245)"><div><div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><cdecl: char* 'ffiPrintString' (char*)><br></div></div><div>41 <F8 78 00> callPrimitive: 120<br></div><div>44 <4C> self<br></div><div>45 <81> send: externalCallFailed<br></div><div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">46 <5C> returnTop<br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div></div></div></blockquote><div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">I check it:<br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div></div><blockquote style="border:1px solid rgb(204,204,204);padding:7px;background-color:rgb(245,245,245)"><div>FFITestLibrary new ffiPrintString: 'foo'  -> 'foo'<br></div></blockquote><div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">Something more basic is missing from the soup.<br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">I look forward to your insights.</div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1"><br></div><div id="m_-5385261034339406692Zm-_Id_-Sgn1">---- On Sun, 10 May 2020 02:17:17 -0400 <b>Beckmann, Tom <<a href="mailto:Tom.Beckmann@student.hpi.uni-potsdam.de" target="_blank">Tom.Beckmann@student.hpi.uni-potsdam.de</a>></b> wrote ----<br></div><br><blockquote style="border-left:1px solid rgb(204,204,204);padding-left:6px;margin:0px 0px 0px 5px"><div>Hi Vanessa,<br><br>thank you for clarifying! Do you know if there's any reason to keep the conditional asking for the osVersion to either return 'GL' or 'libgl.so.1'? In its current state it is broken on most linux systems I tested on (mainly Ubuntu-based), but I was wondering whether the correct fix would be to adapt it to the correct matching string 'linux-gnu' or just have it return 'libgl.so.1' always.<br><br>Best,<br>Tom<br>________________________________________<br>From: Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> on behalf of Vanessa Freudenberg <<a href="mailto:vanessa@codefrau.net" target="_blank">vanessa@codefrau.net</a>><br>Sent: Sunday, May 10, 2020 3:19:00 AM<br>To: The general-purpose Squeak developers list<br>Subject: Re: [squeak-dev] OGLUnixX11LE >> glPixelStorei: with:<br><br>On Sat, May 9, 2020 at 12:05 AM Beckmann, Tom <<a href="mailto:Tom.Beckmann@student.hpi.uni-potsdam.de" target="_blank">Tom.Beckmann@student.hpi.uni-potsdam.de</a><mailto:<a href="mailto:Tom.Beckmann@student.hpi.uni-potsdam.de" target="_blank">Tom.Beckmann@student.hpi.uni-potsdam.de</a>>> wrote:<br>Hi there!<br><br>Replacing the whole #openGLLibraryName method with a simple<br>^ 'GL'<br>should work, as long as you adapt your LD_LIBRARY_PATH to include the arch specific libraries. For example adding<br>export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/"<br>in your squeak.sh before the vm gets started should make sure that the image finds libgl*. Of course, if your libgl.so.1 is not found under that path, adjust accordingly.<br><br>Alternatively, you can also specify the absolute path to the library, e.g.<br>^ '/usr/lib/x86_64-linux-gnu/libGL.so'<br>which may be a safer option to start from if you're having troubles getting it to run.<br><br>'libGL.so' typically is installed by the opengl dev package as a symlink to 'libGL.so.1'. The user package installs 'libGL.so.1' and will *not* be found by the VM if you just specify 'GL' because the VM will only automatically try the '.so' suffix but not '.so.1'.<br><br>That is why 'libGL.so.1' is indeed the correct value to be returned from openGLLibraryName on Linux.<br><br>For the apicall:'s, if you inspect the byte codes of the method, you will in fact notice that is has already been replaced for you. This happens in OpenGL>>#privateInstallLibrary:, but only updates the method's bytecode, not its source code (which is good, because otherwise this would end up in commits or your changes file).<br><br>Yep. As Levente mentioned, you need to switch your browser to show decompiled code to see the actual methods being executed.<br><br>You will also see that apicall has been replaced by cdecl which is the right calling convention on Linux.<br><br>- Vanessa -<br><br><br>Best,<br>Tom<br><br><br></div></blockquote></div><div><br></div></div><br></div><br>
</blockquote></div></div>