<div dir="ltr">On Mon, Sep 8, 2008 at 2:29 PM, John Reppy <span dir="ltr"><<a href="mailto:t-johrep@microsoft.com">t-johrep@microsoft.com</a>></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>
val exportDisplay = _export "glutDisplayCB" stdcall : (unit -> unit) -> unit;<br>
val glutDisplayCB = _address "glutDisplayCB" : 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 "public", but the _address as you've use it has an implied symbol scope of "external". Because it'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 "glutDisplayCB" private : (unit -> unit) -> unit;<br>_address "glutDisplayCB" 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't know if you need 'stdcall' 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've only recently been implemented. Except for the case of taking the address of an exported function, though, it shouldn't be necessary to know how it works.<br>
<br></div></div>