OS_GetEnv result

Alex Waugh alex at alexwaugh.com
Sat Aug 3 09:10:07 PDT 2002


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

> In message <a54832604b.Jo at hobbes.riscos.be>
>           John Tytgat <John.Tytgat at aaug.net> wrote:
> 
> > 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).
> 
> I'm not sure if this will work (at least in the way you describe).  My
> understanding of weak symbols is that the address, not the value, is
> zero if undefined (it effectively doesn't have a value, unless you wish
> to read zero page).
>
> So in other words, we do adopt a new weak symbol, which if defined, the
> value of is put into __riscosify_control.

Having two diffferent variables to perform the same job would be
confusing. It is useful to be able to change the value of
__riscosify_control at run-time as well as compile time.

How about something along the lines of the following?

somewhere.s:

IMPORT |__riscosify_control|, WEAK
EXPORT |__riscosify_control_ptr|

|__riscosify_control_ptr|
    DCD |__riscosify_control|

riscosify.c:

replace all reads of __riscosify_control to
__riscosify_control_ptr ? *__riscosify_control_ptr : 0;


Alex

-- 
Alex Waugh                               alex at alexwaugh.com

PHP, Roots, WebJames and more from http://www.alexwaugh.com/



More information about the gcc mailing list