Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Hey Guys,

Got another for ya.

I know that true static objects ie:

MyObject obj;

WIll not properly call the constructor when building with ADS. However if I have this in Visual C++ it hangs after the default constructor is called. I would assume because if I have need to call ctors for this then the AEEMod_Load never gets called after.

Has anyone ever successfully initialized static objects like this in the emulator?

It doesn't matter to me is the ctors never get called because the memory should stil be reserved and I can initialize the objects seperately.

Thanks!

You must use functions from "AEESTDLIB.h" in your global constructors. Remember, the static intialization happens before the entry point of your mod AEEMod_Load() being called.
On the emulator build, the STD Lib pointer is set as a parameter of AEEMod_Load() and is not avaliable before.
Please check AEEModGen.c for detail.
On the real devices, you can intialize your global object by calling the compiler generated function:
__cpp_initialize__aeabi_() for ads 2.0 and ads 3.0
__cpp_initialise() for ads 1.2

You must use functions from "AEESTDLIB.h" in your global constructors. Remember, the static intialization happens before the entry point of your mod AEEMod_Load() being called.
On the emulator build, the STD Lib pointer is set as a parameter of AEEMod_Load() and is not avaliable before.
Please check AEEModGen.c for detail.
On the real devices, you can intialize your global object by calling the compiler generated function:
__cpp_initialize__aeabi_() for ads 2.0 and ads 3.0
__cpp_initialise() for ads 1.2

How would one use a function there in a global constructor if constructors are never called? I think I'm a little confused.

How would one use a function there in a global constructor if constructors are never called? I think I'm a little confused.

darklen meant "You must NOT call functions from AEESTDLIB" in your global constructors. As he says, because the stdlib pointer has not yet been initialised, using things like MALLOC will cause a crash.

darklen meant "You must NOT call functions from AEESTDLIB" in your global constructors. As he says, because the stdlib pointer has not yet been initialised, using things like MALLOC will cause a crash.

KAJed wrote:How would one use a function there in a global constructor if constructors are never called? I think I'm a little confused.
They *are* called on the emulator.

KAJed wrote:How would one use a function there in a global constructor if constructors are never called? I think I'm a little confused.
They *are* called on the emulator.

So I've noticed.... apparently the problem is that after ctor is called on statics the game does not call AEEModLoad

So I've noticed.... apparently the problem is that after ctor is called on statics the game does not call AEEModLoad