Re: Execution never reaches the 'main' function unless I do several
> Posted by: "masterofsw" m...@yahoo.com masterofsw
> Date: Fri Dec 1, 2006 4:50 am ((PST))
> --- In c..., Andrew Nesterov
> > Hi Timothy,
> > > Re: Execution never reaches the 'main' function unless I do several
> > > By my understanding, the _auto_init function initializes C++ objects
> > > that have been statically allocated (compiled in). The other
> > > functions
> > > are initializing data memory segments such as .data and .bss.
> > Don't recall exactly about .data section, but TI linker never
> > initializes
> > .bss, unless vars declared there were explicitly initialized.
> > I'm not sure if you are using C++ or C, but we have run into a similar
> problem with static objects in C++.
That was a bit inaccurate of me, sorry. I meant C runtime.
> Remember that static objects are initialized before main runs. If you
> are using classes, this can mean that any static object can contain
> code rather than simple initialization. We have, in more than one
> occasion, run into issues were a lot of code runs before main. Twice
> we've ended up with a infinite loop or recursive function calls and
> main was never reached.
All kind of strange things may occur. However I can hardly imagine
an infinite loop or a recurrence inside a constructor...
> If you're only using simple types, this isn't a problem. This isn't
> unique to TI, but a long standing C/C++ initialization problem.
> PS> That stdout/printf problem misteriously not working is a real
> thorn in our side too!
I never tiried to track down this particular one any seriously; though
increasing stack size always helped to get it working.
> Good luck,
> Matt Townsend