Opened 17 years ago

Closed 17 years ago

#354 closed enhancement (fixed)

Build the libraries as dynamic libraries (.DSO) in Symbian

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-0.8.0
Component: common Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp)

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 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: $ ./ 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.

Change History (7)

comment:1 Changed 17 years ago by bennylp

  • Description modified (diff)

comment:2 Changed 17 years ago by bennylp

  • Description modified (diff)

comment:3 Changed 17 years ago by bennylp

  • 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

In r1405:

  • implemented all above, and
  • changed PJLIB to build as DSO in Symbian

The rest of the libraries will follow.

comment:4 Changed 17 years ago by bennylp

In r1410:

  • Changed PJLIB-UTIL and PJNATH to .DSO
  • Added pj_get_version() in PJLIB
  • Changed pj_hex_digits from global variable to macro
  • Indentation change to several function definitions to make it parseable by
  • Added doxygen documentation to new constant accessor functions in pjlib.

comment:5 Changed 17 years ago by bennylp

In r1417:

  • Added accessor functions for SIP method constants, for example pjsip_get_invite_method() to return pjsip_invite_method constant, and so on.
  • Added missing export specifiers to several header files
    • Changed inline functions to non-inline in pjsua.h
    • Put parser constants in sip_parser.h into a struct, which accessed through an accessor function

comment:6 Changed 17 years ago by bennylp

  • Description modified (diff)

comment:7 Changed 17 years ago by bennylp

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.