Dear list, I'm currently trying to port a project (using C++) from mspgcc (3.2.3) to mspgcc4. It is a generic C++ library, running (among other systems) on top of Contiki (which is a C-based firmware/OS).
As far as I know, constructors of global C++ objects are not called automatically, so that the user must call them manually. So far I did this successfully via typedef void(*ctor_t)(); extern ctor_t __ctors_start; extern ctor_t __ctors_end; ... ctor_t ctor = __ctors_start; while( ctor < __ctors_end ) { ctor(); ctor = (ctor_t)((void*)ctor + sizeof(void*)); } However, compiling the project with mspgcc4, it doesn't work anymore. Printing addresses of ctors_start/end via printf( "Call ctors from %04x to %04x\n", (unsigned int)*__ctors_start, (unsigned int)*__ctors_end ); produces a higher number for ctors start address than for the end (looking in the *.map-file, everything looks fine). Do I understand sth wrong (so, is the above code incorrect, and it worked on the 3.2.3 just "by luck")? Do you have an idea, how I should call the constructors? Or is the information above incomplete - then please let me know! Best, Tobias ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users