Skip to content

Commit

Permalink
Get Visual C++ 2005 (aka Visual C++ 8.x) support off the ground
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Steve Hay authored and Steve Hay committed Nov 6, 2006
1 parent f8e2af1 commit 0448a0b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions win32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions win32/makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions win32/win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -4859,9 +4874,19 @@ win32_ctrlhandler(DWORD dwCtrlType)
}


#if _MSC_VER >= 1400
# include <crtdbg.h>
#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
Expand Down
9 changes: 9 additions & 0 deletions win32/win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down

0 comments on commit 0448a0b

Please sign in to comment.