Sheri,
Thanks a lot. I did use cmake for my Visual Studio 2005 project
yesterday and everything works great. And appreciated the advise on
"NoRecurse" option. The PCRE.org peoples have been very helpful.
Best regards,
Jerry
-----Original Message-----
From: Sheri [
mailto:silvermoonwoman@comcast.net]
Sent: Friday, October 23, 2009 12:08 AM
To: chuchiehliu
Cc: pcre-dev@???
Subject: Re: [pcre-dev] FW: PCRE for Windows
chuchiehliu@??? wrote:
> Hello PCRE developers,
>
> I am trying to include PCRE library into my Windows application.
> Download "Developer files" and "Binaries" from Pcre for Windows.
Using
> my Microsoft Visual Studio 2005 C++, based on pcredemo.c source,
created
> a console program and included the pcrelib, pcre3.dll, etc. files
(just
> try to make sure I can include PCRE library first). I managed to
build
> it and created "MyApps.exe". But when I tested it, it does not make
> sense to me (always match). I added few printf (as below) and still
> cannot tell what's wrong. NOTE: the pcre_exec return code rc is "1".
> What it means? The dll is dated 27Mar2007. I tried pcretest.exe
which
> seems working on windows. Any suggestion/comment on - how (what
should
> I use) I can include PCRE library into my Microsoft Visual Studio 2005
> C++ console application.
>
> (command line screen shot dump)
>
> C:>MyApps /abc/ 123abc456
> pattern=/abc/ size=5
> subject=123abc456 size=9
> pcre_exec rc=1
>
> Match succeeded at offset 0
> 0: 9 123abc456
> No named substrings
>
> C:>MyApps /xyz/ 123abc456
> pattern=/xyz/ size=5
> subject=123abc456 size=9
> pcre_exec rc=1
>
> Match succeeded at offset 0
> 0: 9 123abc456
> No named substrings
>
> C:>
>
>
>
> Thanks,
> Jerry
>
>
When there is a match, pcre_exec returns the number of pairs of offsets
in the vector. Since none of your patterns have any substrings, there is
only one pair of offsets (used for the whole match) when there is a
match.
When I run the latest pcredemo program using:
C:> pcredemo "abc" "123abc456"
from the Windows console I get:
Match succeeded at offset 3
0: abc
No named substrings
You should use official source from
<
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/>
The latest PCRE version is 8.00 and was released just a few days ago
<
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.zip>
There is a CHM help file that contains all the documentation for version
8.00 here:
<
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib/pcre-8.00
.chm>
I would suggest to read the page titled NON-UNIX-USE with attention to
how to configure PCRE with CMake. CMake will create a Visual Studio 2005
project you can open and build directly in Visual Studio. If you build a
shared libraries, you will get pcre.dll. If you make a project to build
pcredemo.c all you have to do is configure a dependency on pcre.lib.
Beware of stack overflows. I use the "NoRecurse" option when building
PCRE so that heap rather than stack is used for recursion. If you don't
do so, be sure to allocate adequate stack.
Hope it helps,
Sheri