www.digitalmars.com         C & C++   DMDScript  

c++.rtl - static constuctors call

reply Sc_ <Sc__member pathlink.com> writes:
Guys! All information which can be found in reference is:

"pointer to the constructor or destructor function is placed in a special
segment (XIFU, XIFL, or XIFM). The startup code cinit.obj then looks at the
constructor segment and calls the constructors. The exit function calls the
destructors by looking at the destructor segment XOF (for near data models) or
XO (for far data models)."

Could someone describe all special segments more precisely? Which of them
contains pointers to constuctors, destructors, c initializers and so on.

Actually, how can these pointer be reached, I found very good example how to do
it with MS compiler 
(http://www.codeguru.com/Cpp/misc/misc/threadsprocesses/article.php/c6945__2/)
Could some one give example how the same can be done with DigitalMarc
compiler/linker.

Thank you very much!
Aug 04 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Sc_" <Sc__member pathlink.com> wrote in message
news:cer4e6$7hp$1 digitaldaemon.com...
 Guys! All information which can be found in reference is:

 "pointer to the constructor or destructor function is placed in a special
 segment (XIFU, XIFL, or XIFM). The startup code cinit.obj then looks at

 constructor segment and calls the constructors. The exit function calls

 destructors by looking at the destructor segment XOF (for near data

 XO (for far data models)."

 Could someone describe all special segments more precisely? Which of them
 contains pointers to constuctors, destructors, c initializers and so on.

It isn't written down anywhere, but you can see what's happening by writing simple C++ files that contain the various features, compile them, and run obj2asm on them.
Aug 05 2004
parent reply Alexander Beletsky <Alexander_member pathlink.com> writes:
Thanks! Actually, I thought so...
Currently I have no obj2asm tool, but I explore the .map file genereated by
linked. It haelped me a lot.


In article <ceuv7g$2l0j$1 digitaldaemon.com>, Walter says...
"Sc_" <Sc__member pathlink.com> wrote in message
news:cer4e6$7hp$1 digitaldaemon.com...
 Guys! All information which can be found in reference is:

 "pointer to the constructor or destructor function is placed in a special
 segment (XIFU, XIFL, or XIFM). The startup code cinit.obj then looks at

 constructor segment and calls the constructors. The exit function calls

 destructors by looking at the destructor segment XOF (for near data

 XO (for far data models)."

 Could someone describe all special segments more precisely? Which of them
 contains pointers to constuctors, destructors, c initializers and so on.

It isn't written down anywhere, but you can see what's happening by writing simple C++ files that contain the various features, compile them, and run obj2asm on them.

Aug 05 2004
parent "Walter" <newshound digitalmars.com> writes:
"Alexander Beletsky" <Alexander_member pathlink.com> wrote in message
news:cev8tp$2slk$1 digitaldaemon.com...
 Thanks! Actually, I thought so...
 Currently I have no obj2asm tool, but I explore the .map file genereated

 linked. It haelped me a lot.

obj2asm is available with the extended utility package, www.digitalmars.com/eup.html or the compiler CD www.digitalmars.com/cd.html
Aug 06 2004