<div class="gmail_quote">On Thu, Nov 26, 2009 at 12:18 AM, John M McIntosh <span dir="ltr"><<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>></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'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't refer to osErrorCode directly it's foo->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-> to access<br>
the data. However that'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 "one-off" solution!</div><div><br></div><div>
My setOSErrorCode "works" 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>>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'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'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>
> Then, of course, all I want to do is something like:<br>
><br>
> int ioExit(void)<br>
> {<br>
> inCleanExit = 1;<br>
> exit(osErrorCode);<br>
> /* avoid the warnings here */<br>
> return 0;<br>
><br>
> in sqWin32Window.c...<br>
<br>
</div><div><div></div><div class="h5">--<br>
===========================================================================<br>
John M. McIntosh <<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>> 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>