OS_GetEnv result

John Tytgat John.Tytgat at aaug.net
Sat Aug 3 04:55:53 PDT 2002


In message <f0d51c604b.peter at moo.chocky.org>
          Peter Naulls <peter at chocky.org> wrote:

> In message <4268ea5f4b.Jo at hobbes.riscos.be>
>           John Tytgat <John.Tytgat at aaug.net> wrote:
> 
> > > Something like the setting for a program's DA heap.  If the symbol is
> > > created your the program, then unixlib uses a RO pathname, if not (the
> > > symbol's address is 0), then we unix behaviour on argv[0].
> > 
> > Don't we already have something for this ? __RISCOSIFY_NO_PROCESS in the
> > __riscosify_control global var.  When set, I would assume to see a
> > RISC OS filespec in argv[0].  When not set, I would assume to see an
> > unixified version of the RISC OS filespec, i.e. a Unix filespec.
> 
> But __riscosify_control is set at runtime - after main() is entered.
> The processing on argv[0] takes place right after the program is run -
> before main().  Hence you need a compile time switch, not a runtime one.
> 
> Similarly, the DA heap must be setup before main is entered.

Good point.  I overlooked that.  But as the __RISCOSIFY_NO_PROCESS bit
in __riscosify_control is doing exactly the same, let's merge our idea's :
maybe we should change __riscosify_control into a weak symbol and when it
is not defined by the application, take the value 0 (which is already the
default value now).
A few other bits in __riscosify_control also have an influence how
argv[0] should look like (obviously) so I think we shouldn't introduce
another (weak) variable.  Or was this already the original idea ?

For the UnixLib user relying on a non default __riscosify_control value,
he should do instead of :

---8<---
#include <unixlib/local.h>

int main()
{
__riscosify_control = ...;

...

return ...;
}
---8<---

Do this :

---8<---
#include <unixlib/local.h>

int __riscosify_control = ...;

int main()
{
...

return ...;
}
---8<---

Of course this change in UnixLib means user code change + recompile but
I think that's not too hard.

John.
-- 
John Tytgat, in his comfy chair at home                                 BASS
John.Tytgat at aaug.net                             ARM powered, RISC OS driven



More information about the gcc mailing list