Sunday, June 03, 2007

Building PCRE on Windows

My environment is Visual Studio 2005 on Windows Vista for PCRE 7.1. Since PCRE is written in ANSI C, just follow instructions in the doc NON-UNIX-USE. Remember to turn off some macros in config.h such as HAVE_UNISTD_H.

Two weird things here:

1. Define macro NO_RECURSE in config.h if necessary; otherwise running test on data "testinput2" would fail with stack overflow. The current GnuWin32 PCRE 7.0 suffers from this problem.

2. Add a call to _set_printf_count_output(1) at the beginning of main in pcregrep.c; by default VC CRT does not support the format "%n" and the program pcregrep.exe using such format would crash.

1 comment:

sunny said...

你又周末加班!
太拼了,踩一脚!
踩踩踩!