/[pcre]/code/trunk/pcre_internal.h
ViewVC logotype

Diff of /code/trunk/pcre_internal.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 144 by ph10, Thu Mar 29 13:56:00 2007 UTC revision 145 by ph10, Wed Apr 4 14:06:52 2007 UTC
# Line 83  setjmp and stdarg are used is when NO_RE Line 83  setjmp and stdarg are used is when NO_RE
83  #include <stdlib.h>  #include <stdlib.h>
84  #include <string.h>  #include <string.h>
85    
86  #ifndef PCRE_SPY  /* When compiling a DLL for Windows, the exported symbols have to be declared
87  #define PCRE_DEFINITION       /* Win32 __declspec(export) trigger for .dll */  using some MS magic. I found some useful information on this web page:
88    http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the
89    information there, using __declspec(dllesport) without "extern" we have a
90    definition; with "extern" we have a declaration. The settings here override the
91    setting in pcre.h (which is included below); it defines only PCRE_EXP_DECL,
92    which is all that is needed for applications, which import the symbols. We use:
93    
94      PCRE_EXP_DECL       for declarations
95      PCRE_EXP_DEFN       for definitions of exported functions
96      PCRE_EXP_DATA_DEFN  for definitions of exported variables
97    
98    The reason for the two DEFN macros is that in non-Windows environments, one
99    does not want to have "extern" before variable definitions because it leads to
100    compiler warnings. So we distinguish between functions and variables. In
101    Windows, the two should always be the same.
102    
103    The reason for wrapping this in #ifndef PCRE_EXP_DECL is so that pcretest,
104    which is an application, but needs to import this file in order to "peek" at
105    internals, can #include pcre.h first, can get an application's-eye view.
106    
107    In principle, people compiling for non-Windows, non-Unix-like (i.e. uncommon,
108    special-purpose environments) might want to stick other stuff in front of
109    exported symbols. That's why, in the non-Windows case, we set PCRE_EXP_DEFN and
110    PCRE_EXP_DATA_DEFN only if they are not already set. */
111    
112    #ifndef PCRE_EXP_DECL
113    #  ifdef _WIN32
114    #    ifdef DLL_EXPORT
115    #      define PCRE_EXP_DECL       extern __declspec(dllexport)
116    #      define PCRE_EXP_DEFN       __declspec(dllexport)
117    #      define PCRE_EXP_DATA_DEFN  __declspec(dllexport)
118    #    else
119    #      define PCRE_EXP_DECL       extern
120    #      define PCRE_EXP_DEFN
121    #      define PCRE_EXP_DATA_DEFN
122    #    endif
123    #
124    #  else
125    #    ifdef __cplusplus
126    #      define PCRE_EXP_DECL       extern "C"
127    #    else
128    #      define PCRE_EXP_DECL       extern
129    #    endif
130    #    ifndef PCRE_EXP_DEFN
131    #      define PCRE_EXP_DEFN       PCRE_EXP_DECL
132    #    endif
133    #    ifndef PCRE_EXP_DATA_DEFN
134    #      define PCRE_EXP_DATA_DEFN
135    #    endif
136    #  endif
137  #endif  #endif
138    
139  /* We need to have types that specify unsigned 16-bit and 32-bit integers. We  /* We need to have types that specify unsigned 16-bit and 32-bit integers. We
# Line 178  must begin with PCRE_. */ Line 227  must begin with PCRE_. */
227  #define USPTR const unsigned char *  #define USPTR const unsigned char *
228  #endif  #endif
229    
230    
231    
232  /* Include the public PCRE header and the definitions of UCP character property  /* Include the public PCRE header and the definitions of UCP character property
233  values. */  values. */
234    

Legend:
Removed from v.144  
changed lines
  Added in v.145

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12