summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NON-UNIX-USE12
-rw-r--r--README6
-rw-r--r--configure.ac6
-rw-r--r--pcre.h.in84
-rw-r--r--pcre_compile.c4
-rw-r--r--pcre_config.c2
-rw-r--r--pcre_dfa_exec.c2
-rw-r--r--pcre_exec.c2
-rw-r--r--pcre_fullinfo.c2
-rw-r--r--pcre_globals.c33
-rw-r--r--pcre_info.c2
-rw-r--r--pcre_internal.h55
-rw-r--r--pcre_refcount.c2
-rw-r--r--pcre_study.c2
-rw-r--r--pcre_version.c2
-rw-r--r--pcreposix.c8
-rw-r--r--pcreposix.h38
-rw-r--r--pcretest.c13
18 files changed, 150 insertions, 125 deletions
diff --git a/NON-UNIX-USE b/NON-UNIX-USE
index 2b82b7c..e2009ac 100644
--- a/NON-UNIX-USE
+++ b/NON-UNIX-USE
@@ -29,8 +29,8 @@ library consists entirely of code written in Standard C, and so should compile
successfully on any system that has a Standard C compiler and library. The C++
wrapper functions are a separate issue (see below).
-The PCRE distribution contains some experimental support for "cmake", but this
-is incomplete and not documented. However if you are a "cmake" user you might
+The PCRE distribution contains some experimental support for "cmake", but this
+is incomplete and not documented. However if you are a "cmake" user you might
like to try building with "cmake".
@@ -127,11 +127,11 @@ for use with VP/Borland: makevp_c.txt, makevp_l.txt, makevp.bat, pcregexp.pas.
COMMENTS ABOUT WIN32 BUILDS
-There are two ways of building PCRE using the "congifure, make, make install"
+There are two ways of building PCRE using the "congifure, make, make install"
paradigm on Windows systems: using MinGW or using Cygwin. These are not at all
-the same thing; they are completely different from each other. There is also
-some experimental, undocumented support for building using "cmake", which you
-might like to try if you are familiar with "cmake". However, at the present
+the same thing; they are completely different from each other. There is also
+some experimental, undocumented support for building using "cmake", which you
+might like to try if you are familiar with "cmake". However, at the present
time, the "cmake" process builds only a static library (not a dll), and the
tests are not automatically run.
diff --git a/README b/README
index 23aa1a5..38d4fe4 100644
--- a/README
+++ b/README
@@ -116,9 +116,9 @@ Building PCRE on Unix-like systems
If you are using HP's ANSI C++ compiler (aCC), please see the special note
in the section entitled "Using HP's ANSI C++ compiler (aCC)" below.
-The following instructions assume the use of the widely used "configure, make,
-make install" process. There is also some experimental support for "cmake" in
-the PCRE distribution, but it is incomplete and not documented. However, if you
+The following instructions assume the use of the widely used "configure, make,
+make install" process. There is also some experimental support for "cmake" in
+the PCRE distribution, but it is incomplete and not documented. However, if you
are a "cmake" user, you might want to try it.
To build PCRE on a Unix-like system, first run the "configure" command from the
diff --git a/configure.ac b/configure.ac
index 72b0793..4cfb682 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl empty.
m4_define(pcre_major, [7])
m4_define(pcre_minor, [1])
m4_define(pcre_prerelease, [-RC4])
-m4_define(pcre_date, [2007-03-29])
+m4_define(pcre_date, [2007-04-04])
# Libtool shared library interface versions (current:revision:age)
m4_define(libpcre_version, [0:1:0])
@@ -338,7 +338,7 @@ AC_DEFINE([MAX_DUPLENGTH], [30000], [
change it. Care must be taken if it is increased, because it guards
against integer overflow caused by enormously large patterns.])
-AH_VERBATIM([PCRE_DATA_SCOPE], [
+AH_VERBATIM([PCRE_EXP_DEFN], [
/* If you are compiling for a system other than a Unix-like system or
Win32, and it needs some magic to be inserted before the definition
of a function that is exported by the library, define this macro to
@@ -348,7 +348,7 @@ AH_VERBATIM([PCRE_DATA_SCOPE], [
every exported function that is part of the external API. It does
not appear on functions that are "external" in the C sense, but
which are internal to the library. */
-#undef PCRE_DATA_SCOPE])
+#undef PCRE_EXP_DEFN])
if test "$enable_ebcdic" = "yes"; then
AC_DEFINE_UNQUOTED([EBCDIC], [], [
diff --git a/pcre.h.in b/pcre.h.in
index 5afa9a4..2f1995a 100644
--- a/pcre.h.in
+++ b/pcre.h.in
@@ -46,28 +46,26 @@ POSSIBILITY OF SUCH DAMAGE.
#define PCRE_PRERELEASE @PCRE_PRERELEASE@
#define PCRE_DATE @PCRE_DATE@
-/* Win32 uses DLL by default; it needs special stuff for exported functions
-when building PCRE. */
+/* When an application links to a PCRE DLL in Windows, the symbols that are
+imported have to be identified as such. When building PCRE, the appropriate
+export setting is defined in pcre_internal.h, which includes this file. So we
+don't change an existing definition of PCRE_EXP_DECL. */
-#ifdef _WIN32
-# ifdef PCRE_DEFINITION
-# ifdef DLL_EXPORT
-# define PCRE_DATA_SCOPE __declspec(dllexport)
-# endif
-# else
+#ifndef PCRE_EXP_DECL
+# ifdef _WIN32
# ifndef PCRE_STATIC
-# define PCRE_DATA_SCOPE extern __declspec(dllimport)
+# define PCRE_EXP_DECL extern __declspec(dllimport)
# endif
# endif
#endif
-/* Otherwise, we use the standard "extern". */
+/* By default, we use the standard "extern" declarations. */
-#ifndef PCRE_DATA_SCOPE
+#ifndef PCRE_EXP_DECL
# ifdef __cplusplus
-# define PCRE_DATA_SCOPE extern "C"
+# define PCRE_EXP_DECL extern "C"
# else
-# define PCRE_DATA_SCOPE extern
+# define PCRE_EXP_DECL extern
# endif
#endif
@@ -229,52 +227,52 @@ that is triggered by the (?) regex item. For Virtual Pascal, these definitions
have to take another form. */
#ifndef VPCOMPAT
-PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t);
-PCRE_DATA_SCOPE void (*pcre_free)(void *);
-PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t);
-PCRE_DATA_SCOPE void (*pcre_stack_free)(void *);
-PCRE_DATA_SCOPE int (*pcre_callout)(pcre_callout_block *);
+PCRE_EXP_DECL void *(*pcre_malloc)(size_t);
+PCRE_EXP_DECL void (*pcre_free)(void *);
+PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t);
+PCRE_EXP_DECL void (*pcre_stack_free)(void *);
+PCRE_EXP_DECL int (*pcre_callout)(pcre_callout_block *);
#else /* VPCOMPAT */
-PCRE_DATA_SCOPE void *pcre_malloc(size_t);
-PCRE_DATA_SCOPE void pcre_free(void *);
-PCRE_DATA_SCOPE void *pcre_stack_malloc(size_t);
-PCRE_DATA_SCOPE void pcre_stack_free(void *);
-PCRE_DATA_SCOPE int pcre_callout(pcre_callout_block *);
+PCRE_EXP_DECL void *pcre_malloc(size_t);
+PCRE_EXP_DECL void pcre_free(void *);
+PCRE_EXP_DECL void *pcre_stack_malloc(size_t);
+PCRE_EXP_DECL void pcre_stack_free(void *);
+PCRE_EXP_DECL int pcre_callout(pcre_callout_block *);
#endif /* VPCOMPAT */
/* Exported PCRE functions */
-PCRE_DATA_SCOPE pcre *pcre_compile(const char *, int, const char **, int *,
+PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
const unsigned char *);
-PCRE_DATA_SCOPE pcre *pcre_compile2(const char *, int, int *, const char **,
+PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **,
int *, const unsigned char *);
-PCRE_DATA_SCOPE int pcre_config(int, void *);
-PCRE_DATA_SCOPE int pcre_copy_named_substring(const pcre *, const char *,
+PCRE_EXP_DECL int pcre_config(int, void *);
+PCRE_EXP_DECL int pcre_copy_named_substring(const pcre *, const char *,
int *, int, const char *, char *, int);
-PCRE_DATA_SCOPE int pcre_copy_substring(const char *, int *, int, int, char *,
+PCRE_EXP_DECL int pcre_copy_substring(const char *, int *, int, int, char *,
int);
-PCRE_DATA_SCOPE int pcre_dfa_exec(const pcre *, const pcre_extra *,
+PCRE_EXP_DECL int pcre_dfa_exec(const pcre *, const pcre_extra *,
const char *, int, int, int, int *, int , int *, int);
-PCRE_DATA_SCOPE int pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
+PCRE_EXP_DECL int pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
int, int, int, int *, int);
-PCRE_DATA_SCOPE void pcre_free_substring(const char *);
-PCRE_DATA_SCOPE void pcre_free_substring_list(const char **);
-PCRE_DATA_SCOPE int pcre_fullinfo(const pcre *, const pcre_extra *, int,
+PCRE_EXP_DECL void pcre_free_substring(const char *);
+PCRE_EXP_DECL void pcre_free_substring_list(const char **);
+PCRE_EXP_DECL int pcre_fullinfo(const pcre *, const pcre_extra *, int,
void *);
-PCRE_DATA_SCOPE int pcre_get_named_substring(const pcre *, const char *,
+PCRE_EXP_DECL int pcre_get_named_substring(const pcre *, const char *,
int *, int, const char *, const char **);
-PCRE_DATA_SCOPE int pcre_get_stringnumber(const pcre *, const char *);
-PCRE_DATA_SCOPE int pcre_get_stringtable_entries(const pcre *, const char *,
+PCRE_EXP_DECL int pcre_get_stringnumber(const pcre *, const char *);
+PCRE_EXP_DECL int pcre_get_stringtable_entries(const pcre *, const char *,
char **, char **);
-PCRE_DATA_SCOPE int pcre_get_substring(const char *, int *, int, int,
+PCRE_EXP_DECL int pcre_get_substring(const char *, int *, int, int,
const char **);
-PCRE_DATA_SCOPE int pcre_get_substring_list(const char *, int *, int,
+PCRE_EXP_DECL int pcre_get_substring_list(const char *, int *, int,
const char ***);
-PCRE_DATA_SCOPE int pcre_info(const pcre *, int *, int *);
-PCRE_DATA_SCOPE const unsigned char *pcre_maketables(void);
-PCRE_DATA_SCOPE int pcre_refcount(pcre *, int);
-PCRE_DATA_SCOPE pcre_extra *pcre_study(const pcre *, int, const char **);
-PCRE_DATA_SCOPE const char *pcre_version(void);
+PCRE_EXP_DECL int pcre_info(const pcre *, int *, int *);
+PCRE_EXP_DECL const unsigned char *pcre_maketables(void);
+PCRE_EXP_DECL int pcre_refcount(pcre *, int);
+PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **);
+PCRE_EXP_DECL const char *pcre_version(void);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/pcre_compile.c b/pcre_compile.c
index 10a1f1a..70e30cf 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -5043,7 +5043,7 @@ Returns: pointer to compiled data block, or NULL on error,
with errorptr and erroroffset set
*/
-PCRE_DATA_SCOPE pcre *
+PCRE_EXP_DEFN pcre *
pcre_compile(const char *pattern, int options, const char **errorptr,
int *erroroffset, const unsigned char *tables)
{
@@ -5051,7 +5051,7 @@ return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables);
}
-PCRE_DATA_SCOPE pcre *
+PCRE_EXP_DEFN pcre *
pcre_compile2(const char *pattern, int options, int *errorcodeptr,
const char **errorptr, int *erroroffset, const unsigned char *tables)
{
diff --git a/pcre_config.c b/pcre_config.c
index bcc8a1e..52d2594 100644
--- a/pcre_config.c
+++ b/pcre_config.c
@@ -58,7 +58,7 @@ Arguments:
Returns: 0 if data returned, negative on error
*/
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int
pcre_config(int what, void *where)
{
switch (what)
diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c
index 77ec44f..b972f52 100644
--- a/pcre_dfa_exec.c
+++ b/pcre_dfa_exec.c
@@ -2073,7 +2073,7 @@ Returns: > 0 => number of match offset pairs placed in offsets
< -1 => some kind of unexpected problem
*/
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int
pcre_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data,
const char *subject, int length, int start_offset, int options, int *offsets,
int offsetcount, int *workspace, int wscount)
diff --git a/pcre_exec.c b/pcre_exec.c
index 2212420..ac38b45 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -3712,7 +3712,7 @@ Returns: > 0 => success; value is the number of elements filled in
< -1 => some kind of unexpected problem
*/
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int
pcre_exec(const pcre *argument_re, const pcre_extra *extra_data,
PCRE_SPTR subject, int length, int start_offset, int options, int *offsets,
int offsetcount)
diff --git a/pcre_fullinfo.c b/pcre_fullinfo.c
index daf8516..8c0e54d 100644
--- a/pcre_fullinfo.c
+++ b/pcre_fullinfo.c
@@ -61,7 +61,7 @@ Arguments:
Returns: 0 if data returned, negative on error
*/
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int
pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what,
void *where)
{
diff --git a/pcre_globals.c b/pcre_globals.c
index a19dbdc..dbde57e 100644
--- a/pcre_globals.c
+++ b/pcre_globals.c
@@ -46,37 +46,14 @@ indirection. These values can be changed by the caller, but are shared between
all threads. However, when compiling for Virtual Pascal, things are done
differently, and global variables are not used (see pcre.in). */
-
#include "pcre_internal.h"
-
#ifndef VPCOMPAT
-
-/**************************************************************************
-This code used to be here for use when compiling as a C++ library. However,
-according to Dair Grant it is not needed: "
-
- Including 'extern "C"' in the declaration generates an "initialized and
- declared `extern'" warning from gcc 4.0.1. Since we include pcre_internal.h,
- which includes pcre.h, which declares these prototypes within an extern "C" {}
- block, we shouldn't need the prefix here.
-
-So, from Release 7.0 I have cut this out.
-
-#ifdef __cplusplus
-extern "C" void *(*pcre_malloc)(size_t) = malloc;
-extern "C" void (*pcre_free)(void *) = free;
-extern "C" void *(*pcre_stack_malloc)(size_t) = malloc;
-extern "C" void (*pcre_stack_free)(void *) = free;
-extern "C" int (*pcre_callout)(pcre_callout_block *) = NULL;
-#else
-**************************************************************************/
-
-void *(*pcre_malloc)(size_t) = malloc;
-void (*pcre_free)(void *) = free;
-void *(*pcre_stack_malloc)(size_t) = malloc;
-void (*pcre_stack_free)(void *) = free;
-int (*pcre_callout)(pcre_callout_block *) = NULL;
+PCRE_EXP_DATA_DEFN void *(*pcre_malloc)(size_t) = malloc;
+PCRE_EXP_DATA_DEFN void (*pcre_free)(void *) = free;
+PCRE_EXP_DATA_DEFN void *(*pcre_stack_malloc)(size_t) = malloc;
+PCRE_EXP_DATA_DEFN void (*pcre_stack_free)(void *) = free;
+PCRE_EXP_DATA_DEFN int (*pcre_callout)(pcre_callout_block *) = NULL;
#endif
/* End of pcre_globals.c */
diff --git a/pcre_info.c b/pcre_info.c
index ccd1efa..52ac23f 100644
--- a/pcre_info.c
+++ b/pcre_info.c
@@ -68,7 +68,7 @@ Returns: number of capturing subpatterns
or negative values on error
*/
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int
pcre_info(const pcre *argument_re, int *optptr, int *first_byte)
{
real_pcre internal_re;
diff --git a/pcre_internal.h b/pcre_internal.h
index a59e4db..cf79dd5 100644
--- a/pcre_internal.h
+++ b/pcre_internal.h
@@ -83,8 +83,57 @@ setjmp and stdarg are used is when NO_RECURSE is set. */
#include <stdlib.h>
#include <string.h>
-#ifndef PCRE_SPY
-#define PCRE_DEFINITION /* Win32 __declspec(export) trigger for .dll */
+/* 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(dllesport) without "extern" we have a
+definition; with "extern" we have a declaration. The settings here override the
+setting in pcre.h (which is included below); it defines only PCRE_EXP_DECL,
+which is all that is needed for applications, which import the symbols. We use:
+
+ PCRE_EXP_DECL for declarations
+ PCRE_EXP_DEFN for definitions of exported functions
+ PCRE_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 PCRE_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, can 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 PCRE_EXP_DEFN and
+PCRE_EXP_DATA_DEFN only if they are not already set. */
+
+#ifndef PCRE_EXP_DECL
+# ifdef _WIN32
+# ifdef DLL_EXPORT
+# define PCRE_EXP_DECL extern __declspec(dllexport)
+# define PCRE_EXP_DEFN __declspec(dllexport)
+# define PCRE_EXP_DATA_DEFN __declspec(dllexport)
+# else
+# define PCRE_EXP_DECL extern
+# define PCRE_EXP_DEFN
+# define PCRE_EXP_DATA_DEFN
+# endif
+#
+# else
+# ifdef __cplusplus
+# define PCRE_EXP_DECL extern "C"
+# else
+# define PCRE_EXP_DECL extern
+# endif
+# ifndef PCRE_EXP_DEFN
+# define PCRE_EXP_DEFN PCRE_EXP_DECL
+# endif
+# ifndef PCRE_EXP_DATA_DEFN
+# define PCRE_EXP_DATA_DEFN
+# endif
+# endif
#endif
/* We need to have types that specify unsigned 16-bit and 32-bit integers. We
@@ -178,6 +227,8 @@ must begin with PCRE_. */
#define USPTR const unsigned char *
#endif
+
+
/* Include the public PCRE header and the definitions of UCP character property
values. */
diff --git a/pcre_refcount.c b/pcre_refcount.c
index 40912a8..8339019 100644
--- a/pcre_refcount.c
+++ b/pcre_refcount.c
@@ -63,7 +63,7 @@ Returns: the (possibly updated) count value (a non-negative number), or
a negative error number
*/
-PCRE_DATA_SCOPE int
+PCRE_EXP_DEFN int
pcre_refcount(pcre *argument_re, int adjust)
{
real_pcre *re = (real_pcre *)argument_re;
diff --git a/pcre_study.c b/pcre_study.c
index 6430f8a..3cf5b59 100644
--- a/pcre_study.c
+++ b/pcre_study.c
@@ -491,7 +491,7 @@ Returns: pointer to a pcre_extra block, with study_data filled in and the
NULL on error or if no optimization possible
*/
-PCRE_DATA_SCOPE pcre_extra *
+PCRE_EXP_DEFN pcre_extra *
pcre_study(const pcre *external_re, int options, const char **errorptr)
{
uschar start_bits[32];
diff --git a/pcre_version.c b/pcre_version.c
index 8525a86..1a9ecb2 100644
--- a/pcre_version.c
+++ b/pcre_version.c
@@ -75,7 +75,7 @@ I could find no way of detecting that a macro is defined as an empty string at
pre-processor time. This hack uses a standard trick for avoiding calling
the STRING macro with an empty argument when doing the test. */
-PCRE_DATA_SCOPE const char *
+PCRE_EXP_DEFN const char *
pcre_version(void)
{
return (XSTRING(Z PCRE_PRERELEASE)[1] == 0)?
diff --git a/pcreposix.c b/pcreposix.c
index 33a5a1b..2670346 100644
--- a/pcreposix.c
+++ b/pcreposix.c
@@ -141,7 +141,7 @@ static const char *const pstring[] = {
* Translate error code to string *
*************************************************/
-PCRE_DATA_SCOPE size_t
+PCREPOSIX_EXP_DEFN size_t
regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
{
const char *message, *addmessage;
@@ -176,7 +176,7 @@ return length + addlength;
* Free store held by a regex *
*************************************************/
-PCRE_DATA_SCOPE void
+PCREPOSIX_EXP_DEFN void
regfree(regex_t *preg)
{
(pcre_free)(preg->re_pcre);
@@ -199,7 +199,7 @@ Returns: 0 on success
various non-zero codes on failure
*/
-PCRE_DATA_SCOPE int
+PCREPOSIX_EXP_DEFN int
regcomp(regex_t *preg, const char *pattern, int cflags)
{
const char *errorptr;
@@ -241,7 +241,7 @@ If REG_NOSUB was specified at compile time, the PCRE_NO_AUTO_CAPTURE flag will
be set. When this is the case, the nmatch and pmatch arguments are ignored, and
the only result is yes/no/error. */
-PCRE_DATA_SCOPE int
+PCREPOSIX_EXP_DEFN int
regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags)
{
diff --git a/pcreposix.h b/pcreposix.h
index 04782de..cca559b 100644
--- a/pcreposix.h
+++ b/pcreposix.h
@@ -105,40 +105,36 @@ typedef struct {
regoff_t rm_eo;
} regmatch_t;
-/* Win32 uses DLL by default; it needs special stuff for exported functions
-when building PCRE. */
+/* When an application links to a PCRE DLL in Windows, the symbols that are
+imported have to be identified as such. When building PCRE, the appropriate
+export settings are needed. */
-#ifndef PCRE_DATA_SCOPE
#ifdef _WIN32
-# ifdef PCRE_DEFINITION
-# ifdef DLL_EXPORT
-# define PCRE_DATA_SCOPE __declspec(dllexport)
-# endif
-# else
-# ifndef PCRE_STATIC
-# define PCRE_DATA_SCOPE extern __declspec(dllimport)
-# endif
+# ifndef PCREPOSIX_STATIC
+# define PCREPOSIX_EXP_DECL extern __declspec(dllimport)
+# define PCREPOSIX_EXP_DEFN __declspec(dllimport)
# endif
#endif
-#endif
-/* Otherwise, we use the standard "extern". */
+/* By default, we use the standard "extern" declarations. */
-#ifndef PCRE_DATA_SCOPE
+#ifndef PCREPOSIX_EXP_DECL
# ifdef __cplusplus
-# define PCRE_DATA_SCOPE extern "C"
+# define PCREPOSIX_EXP_DECL extern "C"
+# define PCREPOSIX_EXP_DEFN extern "C"
# else
-# define PCRE_DATA_SCOPE extern
+# define PCREPOSIX_EXP_DECL extern
+# define PCREPOSIX_EXP_DEFN extern
# endif
#endif
/* The functions */
-PCRE_DATA_SCOPE int regcomp(regex_t *, const char *, int);
-PCRE_DATA_SCOPE int regexec(const regex_t *, const char *, size_t,
- regmatch_t *, int);
-PCRE_DATA_SCOPE size_t regerror(int, const regex_t *, char *, size_t);
-PCRE_DATA_SCOPE void regfree(regex_t *);
+PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int);
+PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t,
+ regmatch_t *, int);
+PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t);
+PCREPOSIX_EXP_DECL void regfree(regex_t *);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/pcretest.c b/pcretest.c
index 12d12ac..ebfa3e8 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -67,13 +67,16 @@ input mode under Windows. */
#endif
-#define PCRE_SPY /* For Win32 build, import data, not export */
+/* We have to include pcre_internal.h because we need the internal info for
+displaying the results of pcre_study() and we also need to know about the
+internal macros, structures, and other internal data values; pcretest has
+"inside information" compared to a program that strictly follows the PCRE API.
-/* We include pcre_internal.h because we need the internal info for displaying
-the results of pcre_study() and we also need to know about the internal
-macros, structures, and other internal data values; pcretest has "inside
-information" compared to a program that strictly follows the PCRE API. */
+Although pcre_internal.h does itself include pcre.h, we explicitly include it
+here before pcre_internal.h so that the PCRE_EXP_xxx macros get set
+appropriately for an application, not for building PCRE. */
+#include "pcre.h"
#include "pcre_internal.h"
/* We need access to the data tables that PCRE uses. So as not to have to keep