<div dir="ltr">On Mon, Sep 8, 2008 at 2:29 PM, John Reppy <span dir="ltr">&lt;<a href="mailto:t-johrep@microsoft.com">t-johrep@microsoft.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have the following SML code for handling the display callback in GLUT:<br>
<br>
 &nbsp; &nbsp;val exportDisplay &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = _export &quot;glutDisplayCB&quot; stdcall : (unit -&gt; unit) -&gt; unit;<br>
 &nbsp; &nbsp;val glutDisplayCB &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = _address &quot;glutDisplayCB&quot; : Ptr.t;</blockquote><div><br>In newer versions of MLton (like svn/HEAD), that code is in error. The _export has an implied symbol scope of &quot;public&quot;, but the _address as you&#39;ve use it has an implied symbol scope of &quot;external&quot;. Because it&#39;s external it is trying to import the _address from a DLL. The code it generated is correct for this purpose. What you need to do is this:<br>
<br>_export &quot;glutDisplayCB&quot; private : (unit -&gt; unit) -&gt; unit;<br>_address &quot;glutDisplayCB&quot; private : Ptr.t;<br></div><br>This makes the symbol scope agree in both cases as being private. You could also use public, if you liked. I don&#39;t know if you need &#39;stdcall&#39; or not. Check the OpenGL docs. If you do, it will probably segfault when it tries to run the callback. ;-)<br>
<br>Unfortunately, symbol scopes are not yet documented. They&#39;ve only recently been implemented. Except for the case of taking the address of an exported function, though, it shouldn&#39;t be necessary to know how it works.<br>
<br></div></div>