<div class="gmail_quote">On Thu, Nov 26, 2009 at 12:18 AM, John M McIntosh <span dir="ltr">&lt;<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
PS, in general I don&#39;t recommend doing the cross file reference to osErrorCode and have the<br>
linker do the right thing, because.<br>
<br>
(a) some platforms make better memory references if globals are static.<br>
(b) some platforms use the global VM Foo memory structure so you can&#39;t refer to osErrorCode directly it&#39;s  foo-&gt;osErrorCode<br>
<br>
So by having getOsErrorCode()  hides where the value really comes from.<br>
<br>
However technically if one was wanting to ensure there is no external references to interp.c you would<br>
alter sqVirtualMachine.h and add a set/get api for the Error code then use interpreterProxy-&gt; to access<br>
the data.  However that&#39;s a bit more work than required for a one-off solution.<br></blockquote><div><br></div><div>I think I might have to figure this out for this &quot;one-off&quot; solution!</div><div><br></div><div>
My setOSErrorCode &quot;works&quot; when I start the image up by dragging the image onto the executable in Windows XP, or at least the primitive appears to execute!</div><div><br></div><div>However, when I test the whole point of the exercise by running a batch file with something like:</div>
<div><br></div><div>start /wait squeak.exe working.image</div><div>echo %errorlevel%</div><div><br></div><div>Interpreter&gt;&gt;setOSErrorCode (my new primitive) fails!</div><div><br></div><div>So...starting from Windows works; starting from a DOS-box fails.  Seems like a memory management thing to me?</div>
<div><br></div><div>It&#39;s been a long time, but does anyone try to debug this sort of thing with an actual debugger?  Throw an INT 9 in there and watch what happens?  I might have an old copy of Turbo Debugger somewhere...</div>
<div><br></div><div>Thanks again.  I&#39;ll try to figure out how to use interpreterProxy and see what happens...</div><div><br></div><div>Rob</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
<br>
On 2009-11-25, at 9:01 PM, Rob Rothwell wrote:<br>
<br>
&gt; Then, of course, all I want to do is something like:<br>
&gt;<br>
&gt; int ioExit(void)<br>
&gt; {<br>
&gt;   inCleanExit = 1;<br>
&gt;   exit(osErrorCode);<br>
&gt;   /* avoid the warnings here */<br>
&gt;   return 0;<br>
&gt;<br>
&gt; in sqWin32Window.c...<br>
<br>
</div><div><div></div><div class="h5">--<br>
===========================================================================<br>
John M. McIntosh &lt;<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>&gt;   Twitter:  squeaker68882<br>
Corporate Smalltalk Consulting Ltd.  <a href="http://www.smalltalkconsulting.com" target="_blank">http://www.smalltalkconsulting.com</a><br>
===========================================================================<br>
<br>
<br>
<br>
<br>
</div></div></blockquote></div><br>