From: Steve Hay Date: Mon, 6 Nov 2006 16:26:48 +0000 (+0000) Subject: Get Visual C++ 2005 (aka Visual C++ 8.x) support off the ground X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0448a0bdbfbd5e00696d6b3361b97fb1190434c1;p=p5sagit%2Fp5-mst-13.2.git Get Visual C++ 2005 (aka Visual C++ 8.x) support off the ground This is not a complete fix yet by any means (there are lots of compiler warnings and lots of test failures), but it's a step in the right direction. See the thread starting here: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-10/msg00893.html and continuing here: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-11/msg00102.html for further information p4raw-id: //depot/perl@29218 --- diff --git a/win32/Makefile b/win32/Makefile index 3fbcbec..2044a69 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -434,6 +434,9 @@ DEFINES = $(DEFINES) -DWIN64 -DCONSERVATIVE OPTIMIZE = $(OPTIMIZE) -Wp64 -fp:precise !ENDIF +# Use the MSVCRT read() fix if the PerlCRT was not chosen. This may be not +# necessary with recent MSVCRT's, but we use the fix anyway in case this build +# is going to be run on a system with an old MSVCRT. !IF "$(USE_PERLCRT)" != "define" BUILDOPT = $(BUILDOPT) -DPERL_MSVCRT_READFIX !ENDIF diff --git a/win32/makefile.mk b/win32/makefile.mk index 92263ba..7c9fca7 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -485,6 +485,7 @@ EXEOUT_FLAG = -o LIBOUT_FLAG = # NOTE: we assume that GCC uses MSVCRT.DLL +# See comments about PERL_MSVCRT_rEADFIX in the "cl" compiler section below. BUILDOPT += -fno-strict-aliasing -DPERL_MSVCRT_READFIX .ELSE @@ -544,6 +545,9 @@ DEFINES += -DWIN64 -DCONSERVATIVE OPTIMIZE += -Wp64 -fp:precise .ENDIF +# Use the MSVCRT read() fix if the PerlCRT was not chosen. This may be not +# necessary with recent MSVCRT's, but we use the fix anyway in case this build +# is going to be run on a system with an old MSVCRT. .IF "$(USE_PERLCRT)" != "define" BUILDOPT += -DPERL_MSVCRT_READFIX .ENDIF diff --git a/win32/win32.c b/win32/win32.c index b800ed6..31a54a9 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -133,6 +133,21 @@ _matherr(struct _exception *a) } #endif +#if _MSC_VER >= 1400 +void my_invalid_parameter_handler(const wchar_t* expression, + const wchar_t* function, + const wchar_t* file, + unsigned int line, + uintptr_t pReserved) +{ +# ifdef _DEBUG + wprintf(L"Invalid parameter detected in function %s." + L" File: %s Line: %d\n", function, file, line); + wprintf(L"Expression: %s\n", expression); +# endif +} +#endif + int IsWin95(void) { @@ -4859,9 +4874,19 @@ win32_ctrlhandler(DWORD dwCtrlType) } +#if _MSC_VER >= 1400 +# include +#endif + void Perl_win32_init(int *argcp, char ***argvp) { +#if _MSC_VER >= 1400 + _invalid_parameter_handler oldHandler, newHandler; + newHandler = my_invalid_parameter_handler; + oldHandler = _set_invalid_parameter_handler(newHandler); + _CrtSetReportMode(_CRT_ASSERT, 0); +#endif /* Disable floating point errors, Perl will trap the ones we * care about. VC++ RTL defaults to switching these off * already, but the Borland RTL doesn't. Since we don't diff --git a/win32/win32.h b/win32/win32.h index 2a87528..f761211 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -510,6 +510,15 @@ typedef struct { char pipech; /* one char buffer for handles opened on pipes */ int lockinitflag; CRITICAL_SECTION lock; +#if _MSC_VER >= 1400 +# ifndef _SAFECRT_IMPL + /* Not used in the safecrt downlevel. We do not define them, so we cannot + * use them accidentally */ + char textmode : 7;/* __IOINFO_TM_ANSI or __IOINFO_TM_UTF8 or __IOINFO_TM_UTF16LE */ + char unicode : 1; /* Was the file opened as unicode? */ + char pipech2[2]; /* 2 more peak ahead chars for UNICODE mode */ +# endif +#endif } ioinfo;