The libraries support generation of dynamic link libraries for Symbian ABIv2 target (.dso/Dynamic Shared Object files, in Symbian terms). Similar procedures may be applied for Win32 DLL with some modification.
Depending on the platforms, these steps may be necessary in order to produce the dynamic libraries:
- Create the (Visual Studio) projects to produce DLL output. PJLIB does not provide ready to use project files to produce DLL, so you need to create these projects yourself. For Symbian, the MMP files have been setup to produce DSO files for targets that require them.
- In the (Visual Studio) projects, some macros need to be declared so that appropriate modifiers are added to symbol declarations and definitions. Please see the macro section below for information regarding these macros. For Symbian, these have been taken care by the MMP files.
- Some build systems require .DEF file to be specified when creating the DLL. For Symbian, .DEF files are included in pjlib distribution, in
pjlib/build.symbian directory. These DEF files are created by running
./makedef.sh all from this directory, inside Mingw.
Macros related for building DLL/DSO files:
- For platforms that supports dynamic link libraries generation, it must declare
PJ_EXPORT_SPECIFIER macro which value contains the prefix to be added to symbol definition, to export this symbol in the DLL/DSO. For example, on Win32/Visual Studio, the value of this macro is __declspec(dllexport), and for ARM ABIv2/Symbian, the value is EXPORT_C.
- For platforms that supports linking with dynamic link libraries, it must declare
PJ_IMPORT_SPECIFIER macro which value contains the prefix to be added to symbol declaration, to import this symbol from a DLL/DSO. For example, on Win32/Visual Studio, the value of this macro is __declspec(dllimport), and for ARM ABIv2/Symbian, the value is IMPORT_C.
PJ_IMPORT_SPECIFIER macros above can be declared in your config_site.h if they are not declared by pjlib.
- When PJLIB is built as DLL/DSO, both
PJ_EXPORTING macros must be declared, so that
PJ_EXPORT_SPECIFIER modifier will be added into function definition.
- When application wants to link dynamically with PJLIB, then it must declare
PJ_DLL macro when using/including PJLIB header, so that
PJ_IMPORT_SPECIFIER modifier is properly added into symbol declarations.
When PJ_DLL macro is not declared, static linking is assumed.
For example, here are some settings to produce DLLs with Visual Studio on Windows/Win32:
- Create Visual Studio projects to produce DLL. Add the appropriate project dependencies to avoid link errors.
- In the projects, declare
- Declare these macros in your
#define PJ_EXPORT_SPECIFIER __declspec(dllexport)
#define PJ_IMPORT_SPECIFIER __declspec(dllimport)
- And in the application (that links with the DLL) project, add
PJ_DLL in the macro declarations.