Ticket #354 (closed enhancement: fixed)
Build the libraries as dynamic libraries (.DSO) in Symbian
|Reported by:||bennylp||Owned by:||bennylp|
|Backport to 1.x milestone:||Backported:|
Description (last modified by bennylp) (diff)
Symbian 9 build system with its ABIv2 no longer supports linking with static libraries. Some major works need to be done to support building PJ libraries as dynamic libraries
PJ_DLL and PJ_EXPORTING macros
PJ_DLL and PJ_EXPORTING macros are introduced to control the import/export behavior. The declaration of these macros causes the relevant PJ_DECL and PJ_DEF syntax to be generated.
When the libraries are being built, both PJ_DLL and PJ_EXPORTING macros are set (by the libraries' project files), causing the build process to export the symbols. When application wants to link against PJ dynamic libraries, it should declare PJ_DLL macro only, to signal that application wants to import the symbols from PJ libraries.
When PJ_DLL macro is not set, static linking is assumed.
Please see the comments on building PJLIB as DLL in <pj/config.h> file for more info.
DEF file generation
A simple Mingw shell script was created to generate DEF file from MMP file. To invoke this script:
..build.symbian $ ./makedef.sh pjlib.mmp
This script parses the preprocessor output of each source files and look for EXPORT_C modifier for symbols to export. Because of this, the indentation of some function definitions need to be modified to make it parseable by this script.
Problems with exporting global const variables
It looks like the use of global variables are really discouraged in Symbian, even if they are const variables. They don't work, because their values are not initialized when used by applications. Unfortunately, PJLIB does export some global const variables, in:
- sock.h, for things such as PJ_AF_INET and PJ_SOCK_STREAM constants.
- pool.h, for the default pool factory policy (pj_pool_factory_default_policy).
To fix this, some accessor functions were added:
- sock.h, added pj_AF_INET() function which returns PJ_AF_INET value, pj_SOCK_STREAM() for PJ_SOCK_STREAM, etc. All libraries have been updated to use this function rather than directly accessing the variable.
- pool.h, added pj_pool_factory_get_default_policy() function which returns the default pool factory policy. In addition, user may specify NULL as the policy when calling pj_caching_pool_init() to make it use the default policy.
The accessor functions for socket constants are implemented in a NEW file, sock_common.c.
- Status changed from new to assigned
- Summary changed from Building the libraries as dynamic libraries (.DSO) in Symbian to Build the libraries as dynamic libraries (.DSO) in Symbian