diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-07-31 14:39:09 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-07-31 14:39:09 +0000 |
commit | e188596ef3e912f62e3ae85c8da905a54fc41d8b (patch) | |
tree | ebd384645bf62c640a04fe0308bcbac05e8087e0 /pcrecpp_internal.h | |
parent | 235d0eb42c6281f0d8a1863f866c4d2722f0cdcf (diff) | |
download | pcre-e188596ef3e912f62e3ae85c8da905a54fc41d8b.tar.gz |
Daniel's patch for config.h and Windows DLL declarations (not fully working).
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@199 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcrecpp_internal.h')
-rw-r--r-- | pcrecpp_internal.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/pcrecpp_internal.h b/pcrecpp_internal.h new file mode 100644 index 0000000..f4a7fd5 --- /dev/null +++ b/pcrecpp_internal.h @@ -0,0 +1,50 @@ +#ifndef PCRECPP_INTERNAL_H +#define PCRECPP_INTERNAL_H + +/* When compiling a DLL for Windows, the exported symbols have to be declared +using some MS magic. I found some useful information on this web page: +http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the +information there, using __declspec(dllexport) without "extern" we have a +definition; with "extern" we have a declaration. The settings here override the +setting in pcrecpp.h; it defines only PCRECPP_EXP_DECL, which is all that is +needed for applications (they just import the symbols). We use: + + PCRECPP_EXP_DECL for declarations + PCRECPP_EXP_DEFN for definitions of exported functions + PCRECPP_EXP_DATA_DEFN for definitions of exported variables + +The reason for the two DEFN macros is that in non-Windows environments, one +does not want to have "extern" before variable definitions because it leads to +compiler warnings. So we distinguish between functions and variables. In +Windows, the two should always be the same. + +The reason for wrapping this in #ifndef PCRECPP_EXP_DECL is so that pcretest, +which is an application, but needs to import this file in order to "peek" at +internals, can #include pcre.h first to get an application's-eye view. + +In principle, people compiling for non-Windows, non-Unix-like (i.e. uncommon, +special-purpose environments) might want to stick other stuff in front of +exported symbols. That's why, in the non-Windows case, we set PCRECPP_EXP_DEFN and +PCRECPP_EXP_DATA_DEFN only if they are not already set. */ + +#ifndef PCRECPP_EXP_DECL +# ifdef _WIN32 +# ifndef PCRECPP_STATIC +# define PCRECPP_EXP_DECL extern __declspec(dllexport) +# define PCRECPP_EXP_DEFN __declspec(dllexport) +# define PCRECPP_EXP_DATA_DEFN __declspec(dllexport) +# else +# define PCRECPP_EXP_DECL extern +# define PCRECPP_EXP_DEFN +# define PCRECPP_EXP_DATA_DEFN +# endif +# else +# define PCRECPP_EXP_DECL +# define PCRECPP_EXP_DEFN +# define PCRECPP_EXP_DATA_DEFN +# endif +#endif + +#endif + +/* End of pcrecpp_internal.h */ |