Writeable Static Data in a DLL on Symbian OS 9
Development March 31st. 2007, 11:35pmIf you have programmed on pre-Symbian OS 9 using C++, you may be familiar with the error message “.app has initialized data” during compilation. This error message is caused by global variable. It one of the limitation of executable (.app) on Symbian OS 9 that we cannot define global variables. It is because .app file is actually also a DLL.
Starting from Symbian OS 9, the executable file is always in .exe format. That’s why we can define global variables. How about .dll? I just noticed today that EKA2 (EPOC Kernel Architecture 2), the kernel used by Symbian OS 9 as well as 8.0b and 8.1b, allow static variable. There is a macro, called EPOCALLOWDLLDATA, that needs to be defined in the .mmp file. For example:
TARGET my.dll
TARGETTYPE dll
EPOCALLOWDLLDATA
Bonus Links
- Static data - Official documentation of Symbian OS v9.1.
- Symbian OS support for writeable static data in DLLs - paper from Symbian web site (PDF format).
Comments are disabled.