Ignore:
Timestamp:
Jul 20, 2007 8:08:30 AM (17 years ago)
Author:
bennylp
Message:

Ticket #354: build PJLIB as dynamic libraries (.DSO) in Symbian

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/config.h

    r1333 r1405  
    658658 
    659659/** 
     660 * Guide for building dynamic link libraries (DLL). 
     661 * 
     662 * The libraries support generation of dynamic link libraries for 
     663 * Symbian ABIv2 target (.dso files, in S60 3rd Edition). Similar 
     664 * procedures may be applied for Win32 DLL too, with some modification. 
     665 * 
     666 * Macros related for building DLL/DSO files: 
     667 *  - For platforms that supports dynamic link libraries generation, 
     668 *    it must declare PJ_EXPORT_SPECIFIER macro which value contains 
     669 *    the prefix to be added to symbol definition, to export this  
     670 *    symbol in the DLL/DSO. For example, on Win32/Visual Studio, the 
     671 *    value of this macro is "__declspec(dllexport)", and for ARM  
     672 *    ABIv2/Symbian, the value is \a EXPORT_C.  
     673 *  - For platforms that supports linking with dynamic link libraries, 
     674 *    it must declare PJ_IMPORT_SPECIFIER macro which value contains 
     675 *    the prefix to be added to symbol declaration, to import this  
     676 *    symbol from a DLL/DSO. For example, on Win32/Visual Studio, the 
     677 *    value of this macro is "__declspec(dllimport)", and for ARM  
     678 *    ABIv2/Symbian, the value is \a IMPORT_C.  
     679 *  - When PJLIB is built as DLL/DSO, both \a PJ_DLL and \a PJ_EXPORTING 
     680 *    macros must be declared, so that PJ_EXPORT_SPECIFIER prefix will be 
     681 *    added into function definition. 
     682 *  - When application wants to link dynamically with PJLIB, then it 
     683 *    must declare \a PJ_DLL macro when using/including PJLIB header, 
     684 *    so that PJ_IMPORT_SPECIFIER is properly added into symbol 
     685 *    declarations. 
     686 * 
     687 * When \a PJ_DLL macro is not declared, static linking is assumed. 
     688 */ 
     689 
     690/** 
    660691 * @def PJ_INLINE(type) 
    661692 * @param type The return type of the function. 
     
    665696 
    666697/** 
    667  * @def PJ_DECL(type) 
    668  * @param type The return type of the function. 
    669  * Declare a function. 
    670  */ 
    671 /** 
    672698 * @def PJ_DECL_NO_RETURN(type) 
    673699 * @param type The return type of the function. 
     
    683709 */ 
    684710#ifdef __cplusplus 
    685 #  define PJ_DECL(type)             type 
    686711#  define PJ_DECL_NO_RETURN(type)   type PJ_NORETURN 
    687712#  define PJ_IDECL_NO_RETURN(type)  PJ_INLINE(type) PJ_NORETURN 
     
    689714#  define PJ_END_DECL               } 
    690715#else 
    691 #  define PJ_DECL(type)             extern type 
    692716#  define PJ_DECL_NO_RETURN(type)   PJ_NORETURN type 
    693717#  define PJ_IDECL_NO_RETURN(type)  PJ_NORETURN PJ_INLINE(type) 
     
    696720#endif 
    697721 
     722 
     723/** 
     724 * This macro declares platform/compiler specific specifier prefix 
     725 * to be added to symbol declaration to export the symbol when PJLIB 
     726 * is built as dynamic library. 
     727 * 
     728 * This macro should have been added by platform specific headers, 
     729 * if the platform supports building dynamic library target.  
     730 */ 
     731#ifndef PJ_EXPORT_DECL_SPECIFIER 
     732#   define PJ_EXPORT_DECL_SPECIFIER 
     733#endif 
     734 
     735 
     736/** 
     737 * This macro declares platform/compiler specific specifier prefix 
     738 * to be added to symbol definition to export the symbol when PJLIB 
     739 * is built as dynamic library. 
     740 * 
     741 * This macro should have been added by platform specific headers, 
     742 * if the platform supports building dynamic library target.  
     743 */ 
     744#ifndef PJ_EXPORT_DEF_SPECIFIER 
     745#   define PJ_EXPORT_DEF_SPECIFIER 
     746#endif 
     747 
     748 
     749/** 
     750 * This macro declares platform/compiler specific specifier prefix 
     751 * to be added to symbol declaration to import the symbol. 
     752 * 
     753 * This macro should have been added by platform specific headers, 
     754 * if the platform supports building dynamic library target. 
     755 */ 
     756#ifndef PJ_IMPORT_DECL_SPECIFIER 
     757#   define PJ_IMPORT_DECL_SPECIFIER 
     758#endif 
     759 
     760 
     761/** 
     762 * This macro has been deprecated. It will evaluate to nothing. 
     763 */ 
     764#ifndef PJ_EXPORT_SYMBOL 
     765#   define PJ_EXPORT_SYMBOL(x) 
     766#endif 
     767 
     768 
     769/** 
     770 * @def PJ_DECL(type) 
     771 * @param type The return type of the function. 
     772 * Declare a function. 
     773 */ 
     774#if defined(PJ_DLL) 
     775#   if defined(PJ_EXPORTING) 
     776#       define PJ_DECL(type)        PJ_EXPORT_DECL_SPECIFIER type 
     777#   else 
     778#       define PJ_DECL(type)        PJ_IMPORT_DECL_SPECIFIER type 
     779#   endif 
     780#elif !defined(PJ_DECL) 
     781#   if defined(__cplusplus) 
     782#       define PJ_DECL(type)        type 
     783#   else 
     784#       define PJ_DECL(type)        extern type 
     785#   endif 
     786#endif 
     787 
     788 
    698789/** 
    699790 * @def PJ_DEF(type) 
     
    701792 * Define a function. 
    702793 */ 
    703 #define PJ_DEF(type)      type 
    704  
    705 /** 
    706  * @def PJ_EXPORT_SYMBOL(sym) 
    707  * @param sym The symbol to export. 
    708  * Export the specified symbol in compilation type that requires export 
    709  * (e.g. Linux kernel). 
    710  */ 
    711 #ifdef __PJ_EXPORT_SYMBOL 
    712 #  define PJ_EXPORT_SYMBOL(sym)     __PJ_EXPORT_SYMBOL(sym) 
    713 #else 
    714 #  define PJ_EXPORT_SYMBOL(sym) 
    715 #endif 
     794#if defined(PJ_DLL) && defined(PJ_EXPORTING) 
     795#   define PJ_DEF(type)             PJ_EXPORT_DEF_SPECIFIER type 
     796#elif !defined(PJ_DEF) 
     797#   define PJ_DEF(type)             type 
     798#endif 
     799 
     800 
     801/** 
     802 * @def PJ_DECL_DATA(type) 
     803 * @param type The data type. 
     804 * Declare a global data. 
     805 */  
     806#if defined(PJ_DLL) 
     807#   if defined(PJ_EXPORTING) 
     808#       define PJ_DECL_DATA(type)   PJ_EXPORT_DECL_SPECIFIER extern type 
     809#   else 
     810#       define PJ_DECL_DATA(type)   PJ_IMPORT_DECL_SPECIFIER extern type 
     811#   endif 
     812#elif !defined(PJ_DECL_DATA) 
     813#   define PJ_DECL_DATA(type)       extern type 
     814#endif 
     815 
     816 
     817/** 
     818 * @def PJ_DEF_DATA(type) 
     819 * @param type The data type. 
     820 * Define a global data. 
     821 */  
     822#if defined(PJ_DLL) && defined(PJ_EXPORTING) 
     823#   define PJ_DEF_DATA(type)        PJ_EXPORT_DEF_SPECIFIER type 
     824#elif !defined(PJ_DEF_DATA) 
     825#   define PJ_DEF_DATA(type)        type 
     826#endif 
     827 
    716828 
    717829/** 
     
    734846#endif 
    735847 
     848 
    736849/** 
    737850 * @def PJ_UNUSED_ARG(arg) 
Note: See TracChangeset for help on using the changeset viewer.