Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scribusapi.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef SCRIBUS_API_H
00008 #define SCRIBUS_API_H
00009 
00010 /*
00011  * This header provides a macro to handle correct symbol imports/exports
00012  * on platforms that require explicit instructions to make symbols public,
00013  * or differentiate between exported and imported symbols.
00014  *
00015  * Currently, that's win32, but gcc4's facilities for more selective
00016  * exports can be tied into this too (see bug #1961).
00017  *
00018  * Use this macro in the declaration of classes that must be exported
00019  * to plug-ins. With current Scribus code, that's most of them.
00020  *
00021  * Usage examples:
00022  *
00023  * class SCRIBUS_API PageItem
00024  * {
00025  *     ...
00026  * };
00027  *
00028  * bool SCRIBUS_API doThatThing(void);
00029  *
00030  * For an exception type that may be thrown across a DSO boundary, you must
00031  * use:
00032  *
00033  * class SCEXCEPTIONAPI(SCRIBUS_API) MyException
00034  * {
00035  *     ...
00036  * };
00037  *
00038  * For information on the gcc visibility support see:
00039  *     http://gcc.gnu.org/wiki/Visibility
00040  *     http://people.redhat.com/drepper/dsohowto.pdf
00041  *
00042  */
00043 
00044 #ifdef _WIN32
00045     #ifdef COMPILE_SCRIBUS_MAIN_APP
00046         #define SCRIBUS_API __declspec(dllexport)
00047     #else
00048         #ifdef COMPILE_PLUGIN_AS_DLL
00049             #define SCRIBUS_API __declspec(dllimport)
00050         #else
00051             #define SCRIBUS_API
00052         #endif
00053     #endif
00054 #else
00055     #ifdef HAVE_GCC_SYMBOL_VISIBILITY
00056         /* Forces inclusion of a symbol in the symbol table, so
00057            software outside the current library / app can use it. */
00058         #define SCRIBUS_API __attribute__ ((visibility("default")))
00059         /* Within a section exported with SCRIBUS_API, forces a symbol to be
00060            private to the library / app. Good for private members. */
00061         #define SCRIBUS_LOCAL __attribute__ ((visibility("hidden")))
00062     #else
00063         #define SCRIBUS_API
00064         #define SCRIBUS_LOCAL
00065     #endif
00066 #endif
00067 
00068 /* Throwable classes must always be visible on GCC in all binaries */
00069 #ifdef WIN32
00070   #define SCEXCEPTIONAPI(api) api
00071 #elif defined(HAVE_GCC_SYMBOL_VISIBILITY)
00072   #define SCEXCEPTIONAPI(api) SCRIBUS_API
00073 #else
00074   #define SCEXCEPTIONAPI(api)
00075 #endif
00076 
00077 #endif