This page was last modified 06:50, 24 April 2007.
Writeable static data
From Forum Nokia Wiki
Global Writeable Static Data (WSD) pre-process variables that exists during the lifetime of the process. Sometimes we need WSD for defining variables that are used in some other files. This case is usually happen when porting code from non-Symbian OS enviroment.
WSD on EKA1
EKA1 (EPOC_Kernel_Architecture_1), which is used on Symbian OS 6.1, 7.0, 7.0s, 8.0a, 8.1a, support WSD in EXE only. We cannot define WSD on DLL or APP. If we try to define it, the compiler will report "initialized data" error message.
There are some workarounds to use WSD on EKA1:
- Use TLS (Thread Local Storage). Please check Symbian FAQ and Tech Tips for an example of how to use TLS to define WSD.
- Move global variables into classes. This may involve a lot of works, especially if we use global variables in many different places.
- Use ECompXL. Although ECompXL was originally developed to compress executable on Symbian OS, there is a "side effect" that developers can now define WSD.
WSD on EKA2
EKA2 (EPOC_Kernel_Architecture_2), which is used on Symbian OS 8.0b, 8.1b and the newer version 9, support WSD in EXE and DLL. However, there is a little bit trick for DLL because we have to add the following macro to the .mmp file:
EPOCALLOWDLLDATA
There is some cost, though, which needs to be carefully considered when using WSD on EKA2. Just a quick list of what has to be taken into account:
- EKA2 Emulator only allows a DLL with WSD to load into a single process
- RAM usage for WSD data chunk
- Chunks are a finite resource on ARMv5
- Limit on the number of DLLs in a process with WSD.
References
- Symbian OS support for writeable static data in DLLs (PDF format)
- Static data on Symbian OS 9.1 documentation.
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to exit application from Container class | thilsen_06 | General Symbian C++ | 4 | 2007-02-16 13:33 |
| Posting data to a server | ms_sarwar1 | General Symbian C++ | 28 | 2007-10-27 13:12 |
| How to record High score? | eggy_hj | Mobile Java General | 5 | 2003-05-15 15:05 |
| 程序无法编译成thumb urel | xiaoyao888 | Symbian | 5 | 2005-11-02 08:32 |
| Avoid IAP listing everytime | mobileteam | VoIP | 4 | 2008-04-25 13:10 |
