help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A complex problem


From: Pegasus
Subject: A complex problem
Date: Tue, 3 Jun 2008 20:12:46 +0200

Let's suppose that, under a particular platform,
the compiler doesn't initialize correctly the
constructors and destructors of a
global object at startup.

The compiler is psp-gcc.

I have written two routines,

__do_constructor_initialization_aux

and

__do_destructor_initialization_aux

that, if recalled explictly by the code of
the program, start the routines generated
by the compiler and initialize the global
constructors (o deinitialize the constructors
when the program finish).

Unfortunately, each of this routine can access
only to the .ctor or .dtor section of the module
in which it is compiled, not to the .ctor or .dtor
section of different modules.

So, if you are compiling a project in C++ that
contains n files .o, **in each of these** a routine
__do_constructor_initialization_aux and
a routine __do_destructor_initialization_aux
must be present.

If the project has n object .o, there will be n
__do_constructor_initialization_aux routines and
n __do_destructor_initialization_aux routines.

N isn't a known number, because it depends from
the o. files that the programmer chooses to
create.

The trouble is the following: who start these
routines at startup ?

It is needed a special symbol in psp-gcc or in
psp-ld that makes that, at startup, before that
main () is executed, the cpu executes all
initialitation routines present in each module
that has been linked.

Any idea ?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]