PoDoFo 1.1.0
Loading...
Searching...
No Matches
basedefs.h
1
7#ifndef PODOFO_BASE_DEFS_H
8#define PODOFO_BASE_DEFS_H
9
10/*
11 * This header provides a macro to handle correct symbol imports/exports
12 * on platforms that require explicit instructions to make symbols public,
13 * or differentiate between exported and imported symbols.
14 *
15 * Win32 compilers use this information, and gcc4 can use it on *nix
16 * to reduce the size of the export symbol table and get faster runtime
17 * linking.
18 *
19 * All declarations of public API should be marked with the PODOFO_API macro.
20 * Separate definitions need not be annotated, even in headers.
21 *
22 * Usage examples:
23 *
24 * class PODOFO_API PdfArray : public PdfDataContainer {
25 * ...
26 * };
27 *
28 * bool PODOFO_API doThatThing();
29 */
30
31// Sanity check, can't compile both shared and static library
32#if defined(PODOFO_SHARED) && defined(PODOFO_STATIC)
33 #error "Both PODOFO_SHARED and PODOFO_STATIC defined!"
34#endif
35
36#ifdef PODOFO_STATIC
37
38#define PODOFO_API
39#define PODOFO_EXPORT
40#define PODOFO_IMPORT
41
42#else // PODOFO_SHARED
43#ifndef PODOFO_SHARED
44#define PODOFO_SHARED
45#endif
46
47#if defined(_MSC_VER)
48 #define PODOFO_EXPORT __declspec(dllexport)
49 #define PODOFO_IMPORT __declspec(dllimport)
50 #define PODOFO_DEPRECATED
51#else
52 // NOTE: In non MSVC compilers https://gcc.gnu.org/wiki/Visibility,
53 // it's not necessary to distinct between exporting and importing
54 // the symbols and for correct working of RTTI features is better
55 // always set default visibility both when compiling and when using
56 // the library. The symbol will not be re-exported by other libraries
57 #define PODOFO_EXPORT __attribute__ ((visibility("default")))
58 #define PODOFO_IMPORT __attribute__ ((visibility("default")))
59 #define PODOFO_DEPRECATED __attribute__((__deprecated__))
60#endif
61
62// If detected, undefine some macros that are defined by Windows
63// headers and that may cause errors when consuming PoDoFo. To
64// avoid this behavior, define PODOFO_WIN32_SKIP_UNDEF_MACROS
65// before including PoDoFo headers.
66#if defined(_WIN32) && !defined(PODOFO_WIN32_SKIP_UNDEF_MACROS)
67#ifdef min
68#undef min
69#endif // min
70
71#ifdef max
72#undef max
73#endif // max
74
75#ifdef GetObject
76#undef GetObject
77#endif // GetObject
78
79#ifdef CreateFont
80#undef CreateFont
81#endif // CreateFont
82
83#ifdef DrawText
84#undef DrawText
85#endif // DrawText
86#endif
87
88#if defined(PODOFO_BUILD)
89#define PODOFO_API PODOFO_EXPORT
90#else
91#define PODOFO_API PODOFO_IMPORT
92#endif
93
94#endif
95
96// Set up some other compiler-specific but not platform-specific macros
97
100#define PODOFO_PRIVATE_FRIEND(identifier)
101
102#ifndef PODOFO_3RDPARTY_INTEROP_ENABLED
108#define PODOFO_3RDPARTY_INTEROP_ENABLED 0
109#endif // PODOFO_3RDPARTY_INTEROP_ENABLED
110
111// Include some useful compatibility defines
112#include "basecompat.h"
113
114// Include the configuration file
115#include "podofo_config.h"
116
117#endif // PODOFO_BASE_DEFS_H