Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User jmpep's Avatar
    Join Date
    Feb 2008
    Posts
    12
    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:

    BuiltInFont.h
    Code:
    namespace irr
    {
    namespace gui
    {
    u8 BuiltInFontData[] =
    {
    0x42, 0x4d, 0x4a, 0x20, 0x00, 0x00, 0x00, 0x00,
    /* a lot of elements more */
    };
    }};
    CGUIEnviroment.cpp
    Code:
    namespace irr
    {
    namespace gui
    {
    void CGUIEnvironment::loadBuiltInFont()
    {
    	const c8* filename = "#DefaultFont";
    	io::IReadFile* file = io::createMemoryReadFile(BuiltInFontData, BuiltInFontDataSize, filename, false);
    /* in this last line, BuiltInFontData[0] 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.

  2. #2
    Super Contributor Paul.Todd's Avatar
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644
    Its probably related to this issue:
    http://www3.symbian.com/faq.nsf/AllB...7?OpenDocument
    Download Symbian OS now! [url]http://developer.symbian.org[/url]

  3. #3
    Registered User jmpep's Avatar
    Join Date
    Feb 2008
    Posts
    12
    Quote Originally Posted by Paul.Todd View Post
    Its probably related to this issue:
    http://www3.symbian.com/faq.nsf/AllB...7?OpenDocument
    Thanks you very much for your quick response. At least now I have something to research about. The thing is that there is more writable static data in the DLL and, as far as I know, it is working properly. I'll check it.

Similar Threads

  1. Grid app is crashing... need urgent help...
    By shankha in forum Symbian C++
    Replies: 5
    Last Post: 2010-10-19, 12:07
  2. 2D array class over-ride = operator
    By s4028469 in forum Symbian C++
    Replies: 6
    Last Post: 2007-09-01, 09:56
  3. How to copy pointer to array?
    By chrishawaii in forum Symbian C++
    Replies: 10
    Last Post: 2006-06-06, 12:08
  4. Replies: 5
    Last Post: 2006-02-26, 17:29
  5. Replies: 2
    Last Post: 2005-03-14, 15:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved