<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:2043674715;
        mso-list-type:hybrid;
        mso-list-template-ids:-1309083760 -486528338 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l0:level1
        {mso-level-start-at:2;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:54.0pt;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks for the information.&nbsp; With the addition of &#8220;public&#8221;
annotations, I can now get the program to link, but I get some strange
warnings:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; Warning: resolving _glutDisplayCB by linking to
_glutDisplayCB@0<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; Use --enable-stdcall-fixup to disable these warnings<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; Use --disable-stdcall-fixup to disable these fixups<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; Warning: resolving _glutReshapeCB by linking to
_glutReshapeCB@8<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; Warning: resolving _glutKeyboardCB by linking to
_glutKeyboardCB@12<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; Warning: resolving _glutVisibilityCB by linking to
_glutVisibilityCB@4<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Unfortunately, the program dies almost immediately.&nbsp; What
debugger does one use to track this issues down?&nbsp; The MinGW stuff that
comes with<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>MLton has gcc, but not gdb.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Also, I&#8217;m guessing that adding &#8220;public&#8221; attributes
will break on 20070826?&nbsp; Is there any chance for a new release sometime
soon?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoListParagraph style='margin-left:54.0pt;text-indent:-18.0pt;
mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>John<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> Wesley W. Terpstra
[mailto:wesley@terpstra.ca] <br>
<b>Sent:</b> 08 September 2008 14:00<br>
<b>To:</b> John Reppy<br>
<b>Cc:</b> mlton-user@mlton.org<br>
<b>Subject:</b> Re: [MLton-user] Linking issues with FFI on Vista<o:p></o:p></span></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<p class=MsoNormal>On Mon, Sep 8, 2008 at 2:29 PM, John Reppy &lt;<a
href="mailto:t-johrep@microsoft.com">t-johrep@microsoft.com</a>&gt; wrote:<o:p></o:p></p>

<div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-right:0cm'>

<p class=MsoNormal>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;<o:p></o:p></p>

</blockquote>

<div>

<p class=MsoNormal><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've
use it has an implied symbol scope of &quot;external&quot;. 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 &quot;glutDisplayCB&quot; private : (unit -&gt; unit) -&gt; unit;<br>
_address &quot;glutDisplayCB&quot; private : Ptr.t;<o:p></o:p></p>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><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.<o:p></o:p></p>

</div>

</div>

</div>

</body>

</html>