Hello to all,
I have a problem that is driving me crazy with an array loosing its values. Any help will be very very welcome...
Let start from the beginning. I am porting a graphics engine written in C++ (Irrlicht) to S60 3rd Ed. FP1. In order to debug it, I was using it as a normal application by providing a test main function and generating an EXE. It is working well on that situation. However, a estrange problem has arises when using a stand-alone EXE and the engine as a DLL.
The engine has a big array (8266 chars) declared and initialized in a namespace (irr::gui, concretely), in a file called BuilInFont.h. That array is accesed from a method of a class in the same namespace defined in another file (CGUIEnvironment.cpp) that includes the header file.
The problem is that, when accessed, the values of the array has changed. By debugging I have been able to see that the values of the array are wrong before any of my code has been executed.
To make things worse, if I remove that array from the header file or initialize it to zero, I get an error in some code generated by the compiler (GCCE), concretely in __static_initialization_and_destruction_0, which makes no sense at all to me.
So, to sum up, the situation is:
u8 BuiltInFontData =
0x42, 0x4d, 0x4a, 0x20, 0x00, 0x00, 0x00, 0x00,
/* a lot of elements more */
const c8* filename = "#DefaultFont";
io::IReadFile* file = io::createMemoryReadFile(BuiltInFontData, BuiltInFontDataSize, filename, false);
/* in this last line, BuiltInFontData is equals to 0x8A. Always. */
/* more code */
- The values of BuiltInFontData are changed by the time my code starts.
- If I set BuiltInFontData to zeros, run-time error "exception: 0" in __static_initialization_and_destruction_0.
- If I remove the array, the same error.
Thanks you very much for taking your time to read all this.