[Vm-dev] Return a value from the image to the VM

Rob Rothwell r.j.rothwell at gmail.com
Thu Nov 26 13:30:00 UTC 2009


Never mind!

I had an error in my batch file!  I wasn't running my newly created VM!

It works.

Now just need to work on improving the command line parsing...

Rob

On Thu, Nov 26, 2009 at 8:18 AM, Rob Rothwell <r.j.rothwell at gmail.com>wrote:

> On Thu, Nov 26, 2009 at 12:18 AM, John M McIntosh <
> johnmci at smalltalkconsulting.com> wrote:
>
>> PS, in general I don't recommend doing the cross file reference to
>> osErrorCode and have the
>> linker do the right thing, because.
>>
>> (a) some platforms make better memory references if globals are static.
>> (b) some platforms use the global VM Foo memory structure so you can't
>> refer to osErrorCode directly it's  foo->osErrorCode
>>
>> So by having getOsErrorCode()  hides where the value really comes from.
>>
>> However technically if one was wanting to ensure there is no external
>> references to interp.c you would
>> alter sqVirtualMachine.h and add a set/get api for the Error code then use
>> interpreterProxy-> to access
>> the data.  However that's a bit more work than required for a one-off
>> solution.
>>
>
> I think I might have to figure this out for this "one-off" solution!
>
> 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!
>
> However, when I test the whole point of the exercise by running a batch
> file with something like:
>
> start /wait squeak.exe working.image
> echo %errorlevel%
>
> Interpreter>>setOSErrorCode (my new primitive) fails!
>
> So...starting from Windows works; starting from a DOS-box fails.  Seems
> like a memory management thing to me?
>
> 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...
>
> Thanks again.  I'll try to figure out how to use interpreterProxy and see
> what happens...
>
> Rob
>
>
>
>>
>>
>> On 2009-11-25, at 9:01 PM, Rob Rothwell wrote:
>>
>> > Then, of course, all I want to do is something like:
>> >
>> > int ioExit(void)
>> > {
>> >   inCleanExit = 1;
>> >   exit(osErrorCode);
>> >   /* avoid the warnings here */
>> >   return 0;
>> >
>> > in sqWin32Window.c...
>>
>> --
>>
>> ===========================================================================
>> John M. McIntosh <johnmci at smalltalkconsulting.com>   Twitter:
>>  squeaker68882
>> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
>>
>> ===========================================================================
>>
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20091126/cc06925a/attachment.htm


More information about the Vm-dev mailing list