summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-07-09 16:20:19 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-07-09 16:20:19 +0000
commit4e445de088852324fd84d761b4ec89647722d595 (patch)
treea74e7e14678f6b06ebb2d8e1a6fdbb9ca213bd68
parent952b13a4b1c7fa5517937470b9752c7530dde2d6 (diff)
downloadpcre-4e445de088852324fd84d761b4ec89647722d595.tar.gz
Add PCRE_CALL_CONVENTION for MSVC users; add some missing PCRE_EXP_DEFNs.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@359 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog7
-rw-r--r--NON-UNIX-USE13
-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_get.c18
-rw-r--r--pcre_info.c2
-rw-r--r--pcre_internal.h14
-rw-r--r--pcre_refcount.c2
-rw-r--r--pcre_study.c2
-rw-r--r--pcre_version.c2
-rw-r--r--pcreposix.c8
14 files changed, 56 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index aec68e9..8b25608 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,13 @@ Version 8.0 02 Jul-08
8. Added comments about Mac OS X stack usage to the pcrestack man page and to
test 2 if it fails.
+
+9. Added PCRE_CALL_CONVENTION just before the names of all exported functions,
+ and a #define of that name to empty if it is not externally set. This is to
+ allow users of MSVC to set it if necessary.
+
+10. The PCRE_EXP_DEFN macro which precedes exported functions was missing from
+ the convenience functions in the pcre_get.c source file.
Version 7.7 07-May-08
diff --git a/NON-UNIX-USE b/NON-UNIX-USE
index e6726fa..ea3931f 100644
--- a/NON-UNIX-USE
+++ b/NON-UNIX-USE
@@ -190,6 +190,17 @@ otherwise the pcre_malloc() and pcre_free() exported functions will be declared
__declspec(dllimport), with unwanted results.
+CALLING CONVENTIONS IN WINDOWS ENVIRONMENTS
+
+It is possible to compile programs to use different calling conventions using
+MSVC. Search the web for "calling conventions" for more information. To make it
+easier to change the calling convention for the exported functions in the
+PCRE library, the macro PCRE_CALL_CONVENTION is present in all the external
+definitions. It can be set externally when compiling (e.g. in CFLAGS). If it is
+not set, it defaults to empty; the default calling convention is then used
+(which is what is wanted most of the time).
+
+
COMMENTS ABOUT WIN32 BUILDS (see also "BUILDING PCRE WITH CMAKE" below)
There are two ways of building PCRE using the "configure, make, make install"
@@ -428,5 +439,5 @@ $! Locale could not be set to fr
$!
=========================
-Last Updated: 25 January 2008
+Last Updated: 09 July 2008
****
diff --git a/pcre_compile.c b/pcre_compile.c
index 166241e..4a6cd67 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -5944,7 +5944,7 @@ Returns: pointer to compiled data block, or NULL on error,
with errorptr and erroroffset set
*/
-PCRE_EXP_DEFN pcre *
+PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION
pcre_compile(const char *pattern, int options, const char **errorptr,
int *erroroffset, const unsigned char *tables)
{
@@ -5952,7 +5952,7 @@ return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables);
}
-PCRE_EXP_DEFN pcre *
+PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION
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 454fed9..114f0fb 100644
--- a/pcre_config.c
+++ b/pcre_config.c
@@ -62,7 +62,7 @@ Arguments:
Returns: 0 if data returned, negative on error
*/
-PCRE_EXP_DEFN int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre_config(int what, void *where)
{
switch (what)
diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c
index 9123736..8d38523 100644
--- a/pcre_dfa_exec.c
+++ b/pcre_dfa_exec.c
@@ -2505,7 +2505,7 @@ Returns: > 0 => number of match offset pairs placed in offsets
< -1 => some kind of unexpected problem
*/
-PCRE_EXP_DEFN int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
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 0e69715..27bce6d 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -4384,7 +4384,7 @@ Returns: > 0 => success; value is the number of elements filled in
< -1 => some kind of unexpected problem
*/
-PCRE_EXP_DEFN int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
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 7b001c6..30566bb 100644
--- a/pcre_fullinfo.c
+++ b/pcre_fullinfo.c
@@ -65,7 +65,7 @@ Arguments:
Returns: 0 if data returned, negative on error
*/
-PCRE_EXP_DEFN int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what,
void *where)
{
diff --git a/pcre_get.c b/pcre_get.c
index 68b8de4..6117786 100644
--- a/pcre_get.c
+++ b/pcre_get.c
@@ -65,7 +65,7 @@ Returns: the number of the named parentheses, or a negative number
(PCRE_ERROR_NOSUBSTRING) if not found
*/
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre_get_stringnumber(const pcre *code, const char *stringname)
{
int rc;
@@ -114,7 +114,7 @@ Returns: the length of each entry, or a negative number
(PCRE_ERROR_NOSUBSTRING) if not found
*/
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre_get_stringtable_entries(const pcre *code, const char *stringname,
char **firstptr, char **lastptr)
{
@@ -231,7 +231,7 @@ Returns: if successful:
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
*/
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre_copy_substring(const char *subject, int *ovector, int stringcount,
int stringnumber, char *buffer, int size)
{
@@ -276,7 +276,7 @@ Returns: if successful:
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
*/
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre_copy_named_substring(const pcre *code, const char *subject, int *ovector,
int stringcount, const char *stringname, char *buffer, int size)
{
@@ -308,7 +308,7 @@ Returns: if successful: 0
PCRE_ERROR_NOMEMORY (-6) failed to get store
*/
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre_get_substring_list(const char *subject, int *ovector, int stringcount,
const char ***listptr)
{
@@ -353,7 +353,7 @@ Argument: the result of a previous pcre_get_substring_list()
Returns: nothing
*/
-void
+PCRE_EXP_DEFN void PCRE_CALL_CONVENTION
pcre_free_substring_list(const char **pointer)
{
(pcre_free)((void *)pointer);
@@ -386,7 +386,7 @@ Returns: if successful:
PCRE_ERROR_NOSUBSTRING (-7) substring not present
*/
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre_get_substring(const char *subject, int *ovector, int stringcount,
int stringnumber, const char **stringptr)
{
@@ -433,7 +433,7 @@ Returns: if successful:
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
*/
-int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre_get_named_substring(const pcre *code, const char *subject, int *ovector,
int stringcount, const char *stringname, const char **stringptr)
{
@@ -456,7 +456,7 @@ Argument: the result of a previous pcre_get_substring()
Returns: nothing
*/
-void
+PCRE_EXP_DEFN void PCRE_CALL_CONVENTION
pcre_free_substring(const char *pointer)
{
(pcre_free)((void *)pointer);
diff --git a/pcre_info.c b/pcre_info.c
index 638a475..02cf1c9 100644
--- a/pcre_info.c
+++ b/pcre_info.c
@@ -72,7 +72,7 @@ Returns: number of capturing subpatterns
or negative values on error
*/
-PCRE_EXP_DEFN int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
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 4febd21..7547053 100644
--- a/pcre_internal.h
+++ b/pcre_internal.h
@@ -132,6 +132,20 @@ PCRE_EXP_DATA_DEFN only if they are not already set. */
# endif
#endif
+/* When compiling with the MSVC compiler, it is sometimes necessary to include
+a "calling convention" before exported function names. (This is secondhand
+information; I know nothing about MSVC myself). For example, something like
+
+ void __cdecl function(....)
+
+might be needed. In order so make this easy, all the exported functions have
+PCRE_CALL_CONVENTION just before their names. It is rarely needed; if not
+set, we ensure here that it has no effect. */
+
+#ifndef PCRE_CALL_CONVENTION
+#define PCRE_CALL_CONVENTION
+#endif
+
/* We need to have types that specify unsigned 16-bit and 32-bit integers. We
cannot determine these outside the compilation (e.g. by running a program as
part of "configure") because PCRE is often cross-compiled for use on other
diff --git a/pcre_refcount.c b/pcre_refcount.c
index eeb2897..92e4b85 100644
--- a/pcre_refcount.c
+++ b/pcre_refcount.c
@@ -68,7 +68,7 @@ Returns: the (possibly updated) count value (a non-negative number), or
a negative error number
*/
-PCRE_EXP_DEFN int
+PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
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 f3a7dd4..778851d 100644
--- a/pcre_study.c
+++ b/pcre_study.c
@@ -504,7 +504,7 @@ Returns: pointer to a pcre_extra block, with study_data filled in and the
NULL on error or if no optimization possible
*/
-PCRE_EXP_DEFN pcre_extra *
+PCRE_EXP_DEFN pcre_extra * PCRE_CALL_CONVENTION
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 697b44b..7067cd4 100644
--- a/pcre_version.c
+++ b/pcre_version.c
@@ -79,7 +79,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_EXP_DEFN const char *
+PCRE_EXP_DEFN const char * PCRE_CALL_CONVENTION
pcre_version(void)
{
return (XSTRING(Z PCRE_PRERELEASE)[1] == 0)?
diff --git a/pcreposix.c b/pcreposix.c
index 9782d46..4422316 100644
--- a/pcreposix.c
+++ b/pcreposix.c
@@ -160,7 +160,7 @@ static const char *const pstring[] = {
* Translate error code to string *
*************************************************/
-PCREPOSIX_EXP_DEFN size_t
+PCREPOSIX_EXP_DEFN size_t PCRE_CALL_CONVENTION
regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
{
const char *message, *addmessage;
@@ -195,7 +195,7 @@ return length + addlength;
* Free store held by a regex *
*************************************************/
-PCREPOSIX_EXP_DEFN void
+PCREPOSIX_EXP_DEFN void PCRE_CALL_CONVENTION
regfree(regex_t *preg)
{
(pcre_free)(preg->re_pcre);
@@ -218,7 +218,7 @@ Returns: 0 on success
various non-zero codes on failure
*/
-PCREPOSIX_EXP_DEFN int
+PCREPOSIX_EXP_DEFN int PCRE_CALL_CONVENTION
regcomp(regex_t *preg, const char *pattern, int cflags)
{
const char *errorptr;
@@ -260,7 +260,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. */
-PCREPOSIX_EXP_DEFN int
+PCREPOSIX_EXP_DEFN int PCRE_CALL_CONVENTION
regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags)
{