Page 1 of 1

Global constructors innitialized twice?

Posted: Wed Jun 16, 2010 3:07 pm
by andoma
Hi

It seems to me as the global constructor list is traversed and invoked twice.

Once from __crtmain -> __init -> __do_global_ctors_aux (invoked from lwp code in libogc)
Secondly from main() -> __eabi -> __init -> __do_global_ctors_aux

It seems gcc inserts a call to __eabi in main(). Is this expected? Or am I missing some option to the compiler?

Re: Global constructors innitialized twice?

Posted: Fri Jul 16, 2010 1:37 am
by cdmac
I've noticed that my Game class (static object) has its constructor called twice. I couldn't work out what was going on as my Windows build only has it called once. Is this a known bug?

Thanks,
Aaron

Re: Global constructors innitialized twice?

Posted: Wed Jul 28, 2010 1:14 pm
by WinterMute
Yes, known bug, sorry. When I switched to the standard eabi target from the custom powerpc-gekko target I forgot about the insertion of the function to call constructors. I'm planning on another devkitPPC release fairly soon - I'm looking into some other reported issues that are proving to be troublesome to find a consistent testcase for.

Re: Global constructors innitialized twice?

Posted: Wed Jul 28, 2010 10:01 pm
by cdmac
Cool, I look forward to the new release. I've got a work-around in the meantime so it's not a big deal, but it was quite puzzling!

Thanks,
Aaron