[gccsdk] Using Dynamic Areas

John Tytgat John.Tytgat at aaug.net
Sat Jul 19 07:10:52 PDT 2008

In message <d6715ac14f.admin at snowstone.org.uk>
          Adam <lists at snowstone.org.uk> wrote:

> On 19 Jul, Lee Noar  wrote:
> > Adam wrote:
> > > Hi,
> > > 
> > > How do I enable the use of dynamic areas for my app, rather than the
> > > default use of the wimpslot (GCC3.4.6)?
> > 
> > You set a system variable with a name based on that of your binary,
> > eg,  for gcc you would use:
> > 
> > Set gcc$heap ""
> OK, thanks. Does <appname$heap> have to be active at compile time, or
> just run time?

At run time.  Just curious: why would you like specifically set it ? We had
an older suggestion to actually change the default (when appname$heap is
not set) based on whether we're running on RISC OS 5 or not (i.e. whether
the WimpSlot size is limited to 28 MByte or not) as this is probably the
biggest reason to explicitly set it.

> Anyway, I guess that means I have to give my binary a name
> somehow...

I don't think so.  Suppose you have a !RunImage built which is hardly
unique in its name and being part of real Wimp application, I think you can
actually use your application name and use appname$heap while setting this
too as __program_name string to "appname".

> Looking at the Usage file[1] and the UnixLib header files, I think I need
> to do:
>   #include <unixlib/features.h>

#include <features.h>, no ?

>   const char * const * const ___program_name = "BayTrader";

Two leading underscores.

> Unfortunately I'm still flumoxed:
>  - How many "_"s should there be? The comments seem to say 2, but the
>    actual definition uses 3.

The 3 leading underscore variants are internal to UnixLib and is actually
the pointer to the __program_name variable supplied by the user or NULL
when not.  This is how WEAK AOF symbols work (and that's different compared
to ELF).

>  - My #include line doesn't work. What's the correct way to refer to the
>    unixlib headers?
>  - I'm completely lost about the series of three "const" declarations
>    and the compiler says "initialization from incompatible pointer type".
> Sorry - I'm sure I'm making this more complicated than it should be!

No I don't think so.  I think just a little bit more documentation is
needed.  I *think* you just need to add:

  const char *__program_name = "BayTrader";

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