| 1 |
#ifndef PCRECPP_INTERNAL_H
|
| 2 |
#define PCRECPP_INTERNAL_H
|
| 3 |
|
| 4 |
/* When compiling a DLL for Windows, the exported symbols have to be declared
|
| 5 |
using some MS magic. I found some useful information on this web page:
|
| 6 |
http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the
|
| 7 |
information there, using __declspec(dllexport) without "extern" we have a
|
| 8 |
definition; with "extern" we have a declaration. The settings here override the
|
| 9 |
setting in pcrecpp.h; it defines only PCRECPP_EXP_DECL, which is all that is
|
| 10 |
needed for applications (they just import the symbols). We use:
|
| 11 |
|
| 12 |
PCRECPP_EXP_DECL for declarations
|
| 13 |
PCRECPP_EXP_DEFN for definitions of exported functions
|
| 14 |
PCRECPP_EXP_DATA_DEFN for definitions of exported variables
|
| 15 |
|
| 16 |
The reason for the two DEFN macros is that in non-Windows environments, one
|
| 17 |
does not want to have "extern" before variable definitions because it leads to
|
| 18 |
compiler warnings. So we distinguish between functions and variables. In
|
| 19 |
Windows, the two should always be the same.
|
| 20 |
|
| 21 |
The reason for wrapping this in #ifndef PCRECPP_EXP_DECL is so that pcretest,
|
| 22 |
which is an application, but needs to import this file in order to "peek" at
|
| 23 |
internals, can #include pcre.h first to get an application's-eye view.
|
| 24 |
|
| 25 |
In principle, people compiling for non-Windows, non-Unix-like (i.e. uncommon,
|
| 26 |
special-purpose environments) might want to stick other stuff in front of
|
| 27 |
exported symbols. That's why, in the non-Windows case, we set PCRECPP_EXP_DEFN and
|
| 28 |
PCRECPP_EXP_DATA_DEFN only if they are not already set. */
|
| 29 |
|
| 30 |
#ifndef PCRECPP_EXP_DECL
|
| 31 |
# ifdef _WIN32
|
| 32 |
# ifndef PCRECPP_STATIC
|
| 33 |
# define PCRECPP_EXP_DECL extern __declspec(dllexport)
|
| 34 |
# define PCRECPP_EXP_DEFN __declspec(dllexport)
|
| 35 |
# define PCRECPP_EXP_DATA_DEFN __declspec(dllexport)
|
| 36 |
# else
|
| 37 |
# define PCRECPP_EXP_DECL extern
|
| 38 |
# define PCRECPP_EXP_DEFN
|
| 39 |
# define PCRECPP_EXP_DATA_DEFN
|
| 40 |
# endif
|
| 41 |
# else
|
| 42 |
# define PCRECPP_EXP_DECL
|
| 43 |
# define PCRECPP_EXP_DEFN
|
| 44 |
# define PCRECPP_EXP_DATA_DEFN
|
| 45 |
# endif
|
| 46 |
#endif
|
| 47 |
|
| 48 |
#endif
|
| 49 |
|
| 50 |
/* End of pcrecpp_internal.h */
|