[OpendTect_Developers] Developers Digest, Vol 52, Issue 1

Ranojay Sen ranojay at opendtect.org
Mon Sep 20 14:26:03 CEST 2010


Dear All,
     I already replied to Yan Gaohan separately with this topic, I am 
posting again for others to know about the answer as well.
> Today's Topics:
>
>     1. about OD function using in CRTMainStartup	routine (??)
>
> Hi all,
>          I am debugging OD myself, In microsoft's windows OS, i found some functions ,such as "const char* GetEnvVar( const char* env )", which were used before main function, actually in function mainCRTStartup. I want to know what OD do that some functions like  "GetEnvVar" were called in the function mainCRTStartup.
>          Best regards for all of you.
>                                                                            yan gaohan
>    
It is the question that how some function in OpendTect gets called from 
mainCRTStartup() routine and that is even before the main function of 
the application?
Normally an application starts with the main() function and so it is 
most likely that it should be called at the very beginning of the 
application startup. But while debugging our code it is seen that a lot 
of functions get called even before the control reaches the main 
function. What I checked from the call-stack, it is actually getting 
called from the constructor of the global variable. The global variables 
are immediately getting initialised from the mainCRTStartup() and those 
objects use these functions to populate their member variables. You can 
try this with a simple class and make its object global , then you will 
see the constructor of that class will be called from the 
mainCRTStartup(). Apparently all the global objects are initialised from 
mainCRTStartup(), and even before the applications "main" function is 
reached.

   Any comments or suggestions on this matter are welcome.

Regards
Ranojay

-
Ranojay Sen
dGB Earth Sciences - India
304, Gateway Plaza
Hiranandani Gardens, Powai
Mumbai-400076
India
Phone: +91 22 25704984
Mobile: +91 9930834087





More information about the Developers mailing list