summaryrefslogtreecommitdiff
path: root/pcredemo.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-01-25 17:23:16 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-01-25 17:23:16 +0000
commit7cc0519b65e7d4c373d1ec158efa4df21227621e (patch)
treedce4bb64001586a3cedd53682cc2504922fa57d9 /pcredemo.c
parentd6a5e7871428efb6fbe2a1f4fc7a6679e4fe0d1d (diff)
downloadpcre-7cc0519b65e7d4c373d1ec158efa4df21227621e.tar.gz
Update comments in pcredemo.c to point out the necessity of using PCRE_STATIC
when linking statically on Windows. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@315 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcredemo.c')
-rw-r--r--pcredemo.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/pcredemo.c b/pcredemo.c
index 4068e3e..87352b9 100644
--- a/pcredemo.c
+++ b/pcredemo.c
@@ -4,9 +4,11 @@
/* This is a demonstration program to illustrate the most straightforward ways
of calling the PCRE regular expression library from a C program. See the
-pcresample documentation for a short discussion.
+pcresample documentation for a short discussion ("man pcresample" if you have
+the PCRE man pages installed).
+
+In Unix-like environments, compile this program thuswise:
-Compile thuswise:
gcc -Wall pcredemo.c -I/usr/local/include -L/usr/local/lib \
-R/usr/local/lib -lpcre
@@ -14,8 +16,15 @@ Replace "/usr/local/include" and "/usr/local/lib" with wherever the include and
library files for PCRE are installed on your system. You don't need -I and -L
if PCRE is installed in the standard system libraries. Only some operating
systems (e.g. Solaris) use the -R option.
-*/
+Building under Windows:
+
+If you want to statically link this program against a non-dll .a file, you must
+define PCRE_STATIC before including pcre.h, otherwise the pcre_malloc() and
+pcre_free() exported functions will be declared __declspec(dllimport), with
+unwanted results. So in this environment, uncomment the following line. */
+
+/* #define PCRE_STATIC */
#include <stdio.h>
#include <string.h>
@@ -129,8 +138,8 @@ printf("\nMatch succeeded at offset %d\n", ovector[0]);
/*************************************************************************
* We have found the first match within the subject string. If the output *
-* vector wasn't big enough, set its size to the maximum. Then output any *
-* substrings that were captured. *
+* vector wasn't big enough, say so. Then output any substrings that were *
+* captured. *
*************************************************************************/
/* The output vector wasn't big enough */
@@ -155,7 +164,7 @@ for (i = 0; i < rc; i++)
/**************************************************************************
* That concludes the basic part of this demonstration program. We have *
* compiled a pattern, and performed a single match. The code that follows *
-* first shows how to access named substrings, and then how to code for *
+* shows first how to access named substrings, and then how to code for *
* repeated matches on the same subject. *
**************************************************************************/