×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    7

    initializing a big array

    Hi, I am trying to initialize a big array in my ConstructL method of a container. I am initializing it like this: TInt bigArray[35][264]= {some values};
    Everytime I compile I get a linker error. However, if I make the array global, I get no error and everything works fine. I can not make it global though because then it will not compile for armi/thumb. Anybody know what I can do in this situation?

  2. #2
    Regular Contributor
    Join Date
    May 2005
    Location
    Brasov, Romania
    Posts
    431

    Re: initializing a big array

    Have you tried:
    Code:
    static const TInt const bigArray[35][264] = {some_values};
    ?

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    7

    Re: initializing a big array

    Yeah, I tried it, but I can not make the array const because I need to change some of it's values later in the program.

  4. #4
    Regular Contributor
    Join Date
    May 2005
    Location
    Brasov, Romania
    Posts
    431

    Re: initializing a big array

    Try another way of stocking big chunks of data: lists etc.... arrays are some of the worst solutions...

  5. #5
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: initializing a big array

    Remeber in C that a two dimensional array is an just a single array of rows, so any element can be indexed as row * maxRowWidth + column.

    So I suggest you create a static const array of data then in when you need to access the array alloc a block of memory of the same size and copy the elements from the static array into it, then from that point on use the array.

    There are also some tricks you can play with sparse arrays to reduce footprint etc.

    If it was me doing it I would probably create a seperate resource file and then when needed read the data from the resource into the application. This would reduce the footprint of the exe and probably be more efficient overall, though it is slightly more difficult to develop.

  6. #6
    Registered User
    Join Date
    Jan 2006
    Posts
    7

    Re: initializing a big array

    Thanks. I am doing it like you said. We are on a tight schedule(school project) so I am just going to use the copying method you described. If this was an actual market product, I would try and do the resource method. Once again, thanks a lot.

  7. #7
    Regular Contributor
    Join Date
    May 2004
    Location
    Melbourne, Australia
    Posts
    75

    Re: initializing a big array

    Just out of curiosity, whats the linker error that youre getting?

    cheers,
    aymen

Similar Threads

  1. Java Application running on WTK but not on S60 SDK
    By roman.benz in forum Mobile Java Tools & SDKs
    Replies: 6
    Last Post: 2009-06-09, 14:38
  2. Replies: 5
    Last Post: 2006-02-26, 17:29
  3. Drawing PNG images against Array Images
    By melas21 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2004-01-19, 21:55
  4. Delete a 2dim array of pointers
    By ghioldi in forum Symbian
    Replies: 0
    Last Post: 2003-07-21, 08:30
  5. Exceptions while loading application
    By avinash_rs in forum Mobile Java General
    Replies: 0
    Last Post: 2003-06-09, 10:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×