Static Library Usage in Symbian OS
Symbian build tools provide the possibility to link objects into a lib file, which can be linked to other sources using the library’s headers. The use of static libraries should be seen as an option in case where no DLL is required, but modularization and low-level version control should be accomplished. As an advantage, the source files need not be given in cases where an engine is sold to developers. Also when static libraries are used from the start of a project, later it is easy to convert the application to make use of static DLL framework.
Creating a Static Library
Symbian OS has target type lib defining that the compiled object codes should be linked into a static library. As with other target types (for example, APP and DLL), this will set UID1 correctly, and no other UID definitions are needed.
Here is a sample MMP file:
As a static library is just a collection of objects, it does not require to be linked against any import libraries. Hence, in the MMP file of the static library, LIBRARY and SYSTEMLIBRARY statements should not be used. Instead, the user of the static library is responsible for linking against all the required import libraries.
Using global and writable static data (WSD) in static libraries is possible but not recommended as it increases memory consumption and has limited support in the emulator. Furthermore, WSD may cause problems if the library is later converted into a static interface DLL.
Using Static Library
The user of the static library should list the static library with the statement STATICLIBRARY in its MMP file. The user of the static library must list all the dlls used by the static library in its MMP file using LIBRARY and/or SYSTEMLIBRARY statements.
Full example: Eldtobhu(StaticLib).zip