Article # 105, added by Geoworks, historical record
| first | previous | index | next | last |

Moving class defns to their own resource (out of dgroup)




If you have defined so many subclasses in your application that
glue complains that your dgroup is getting too large (>10kb), then
you might consider moving your class definition tables out of dgroup
and into their own resource.  (Consider this after you've decided that
you really need all those subclasses, and you've combined/removed
as many as you can.)

You also need to do this (i.e., put your class tables in their own
resource) if your application will reside in ROM on a device and 
run XIP.

All the classes will still be in the same (fixed) block, but at least
the stack (2kb) won't be in that block as well.

To do this, simply define your classes as usual in your .goc file, but
make the following change in your .gp file:

        resource MYCLASSSTRUCTURES      fixed read-only shared

(If the app is named Hello, do NOT name your new resource
HELLOCLASSSTRUCTURES, since that's the default name -- choose
something else, as done above.)

You'll also have to create a local.mk file, to customize the makefile.
It should look exactly as follows:

#
# -C flag puts class tables in their own resource,
# instead of dgroup.
#
GOCFLAGS        += -CMyClassStructures
#
# Include the system makefile.
#
#include <$(SYSMAKEFILE)>

N.B.: The Swat command "classes" will no longer work, since the
command looks in dgroup to find your class definitions.  So you'll
have to set breakpoints in your methods using alternate means (viewing
the source code and using the mouse to set the breakpoint; or using
"stop at :" syntax.)

One slight benefit above that of reducing the size of dgroup is that
if your app is ever made XIP, this is one of the steps you'd have to
do anyway.