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

John M McIntosh johnmci at smalltalkconsulting.com
Thu Nov 26 05:18:37 UTC 2009

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. 

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

More information about the Vm-dev mailing list