summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/Makefile9
-rw-r--r--win32/PerlCRT.def701
-rw-r--r--win32/config.gc10
-rw-r--r--win32/genmk95.pl7
-rw-r--r--win32/gstartup.c324
-rw-r--r--win32/makefile.mk121
-rw-r--r--win32/oldnames.def115
-rw-r--r--win32/perlhost.h2
-rw-r--r--win32/perllib.c2
-rw-r--r--win32/runperl.c4
-rw-r--r--win32/win32.c2
-rw-r--r--win32/win32.h21
12 files changed, 64 insertions, 1254 deletions
diff --git a/win32/Makefile b/win32/Makefile
index 301b804e9b..b3c6e5677f 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -76,6 +76,7 @@ INST_ARCH = \$(ARCHNAME)
#
# uncomment to enable the implicit "host" layer for all system calls
# made by perl. This is needed and auto-enabled by USE_OBJECT above.
+# This is also needed to get fork().
#
#USE_IMP_SYS = define
@@ -93,7 +94,7 @@ INST_ARCH = \$(ARCHNAME)
#
# uncomment to enable use of PerlCRT.DLL when using the Visual C compiler.
-# Highly recommended. It has patches that fix known bugs in MSVCRT.DLL.
+# It has patches that fix known bugs in older versions of MSVCRT.DLL.
# This currently requires VC 5.0 with Service Pack 3 or later.
# Get it from CPAN at http://www.perl.com/CPAN/authors/id/D/DO/DOUGL/
# and follow the directions in the package to install.
@@ -161,7 +162,11 @@ CCLIBDIR = $(CCHOME)\lib
#
#BUILDOPT = $(BUILDOPT) -DPERL_EXTERNAL_GLOB
-# Enabling this runs a cloned toplevel interpreter (fails tests)
+# Enabling this causes perl to do its own CR/LF conversions, and is required
+# if you want to be able to use the bytecode compiler and ByteLoader
+BUILDOPT = $(BUILDOPT) -DUSE_BINMODE_SCRIPTS
+
+# Enabling this runs a cloned toplevel interpreter (*EXPERIMENTAL*, fails tests)
#BUILDOPT = $(BUILDOPT) -DTOP_CLONE
# specify semicolon-separated list of extra directories that modules will
diff --git a/win32/PerlCRT.def b/win32/PerlCRT.def
deleted file mode 100644
index 6376e5a2cb..0000000000
--- a/win32/PerlCRT.def
+++ /dev/null
@@ -1,701 +0,0 @@
-;
-; PerlCRT.def
-;
-; Dll export file for PerlCRT.dll
-; this is needed for GCC/Mingw32 builds of Perl, since GCC
-; can't understand MSVC-ish .lib files
-;
-; Created from the output of 'nm PerlCRT.lib | grep "00000000 T"'
-; -- Benjamin Stuhl <sho_pi@hotmail.com> 10-17-1999
-
-EXPORTS
- wscanf
- wprintf
- wctomb
- wcsxfrm
- wcstoul
- wcstombs
- wcstol
- wcstok
- wcstod
- wcsstr
- wcsspn
- wcsrchr
- wcspbrk
- wcsncpy
- wcsncmp
- wcsncat
- wcslen
- wcsftime
- wcscspn
- wcscpy
- wcscoll
- wcscmp
- wcschr
- wcscat
- vwprintf
- vswprintf
- vsprintf
- vprintf
- vfwprintf
- vfprintf
- ungetwc
- ungetc
- towupper
- towlower
- toupper
- tolower
- tmpnam
- tmpfile
- time
- tanh
- tan
- system
- swscanf
- swprintf
- strxfrm
- strtoul
- strtol
- strtok
- strtod
- strstr
- strspn
- strrchr
- strpbrk
- strncpy
- strncmp
- strncat
- strlen
- strftime
- strerror
- strcspn
- strcpy
- strcoll
- strcmp
- strchr
- strcat
- sscanf
- srand
- sqrt
- sprintf
- sinh
- sin
- signal
- setvbuf
- setlocale
- setbuf
- scanf
- rewind
- rename
- remove
- realloc
- rand
- raise
- qsort
- putwchar
- putwc
- puts
- putchar
- putc
- printf
- pow
- perror
- modf
- mktime
- memset
- memmove
- memcpy
- memcmp
- memchr
- mbtowc
- mbstowcs
- mblen
- malloc
- longjmp
- log10
- log
- localtime
- localeconv
- ldiv
- ldexp
- labs
- isxdigit
- iswxdigit
- iswupper
- iswspace
- iswpunct
- iswprint
- iswlower
- iswgraph
- iswdigit
- iswctype
- iswcntrl
- iswascii
- iswalpha
- iswalnum
- isupper
- isspace
- ispunct
- isprint
- islower
- isleadbyte
- isgraph
- isdigit
- iscntrl
- isalpha
- isalnum
- is_wctype
- gmtime
- getwchar
- getwc
- gets
- getenv
- getchar
- getc
- fwscanf
- fwrite
- fwprintf
- ftell
- fsetpos
- fseek
- fscanf
- frexp
- freopen
- free
- fread
- fputws
- fputwc
- fputs
- fputc
- fprintf
- fopen
- fmod
- floor
- fgetws
- fgetwc
- fgets
- fgetpos
- fgetc
- fflush
- ferror
- feof
- fclose
- fabs
- exp
- exit
- div
- difftime
- ctime
- cosh
- cos
- clock
- clearerr
- ceil
- calloc
- bsearch
- atol
- atoi
- atof
- atan2
- atan
- asin
- asctime
- acos
- abs
- abort
- _yn
- _y1
- _y0
- _wutime
- _wunlink
- _wtol
- _wtoi64
- _wtoi
- _wtmpnam
- _wtempnam
- _wsystem
- _wstrtime
- _wstrdate
- _wstati64
- _wstat
- _wsplitpath
- _wspawnvpe
- _wspawnvp
- _wspawnve
- _wspawnv
- _wspawnlpe
- _wspawnlp
- _wspawnle
- _wspawnl
- _wsopen
- _wsetlocale
- _wsearchenv
- _wrmdir
- _write
- _wrename
- _wremove
- _wputenv
- _wpopen
- _wperror
- _wopen
- _wmktemp
- _wmkdir
- _wmakepath
- _wgetenv
- _wgetdcwd
- _wgetcwd
- _wfullpath
- _wfsopen
- _wfreopen
- _wfopen
- _wfindnexti64
- _wfindnext
- _wfindfirsti64
- _wfindfirst
- _wfdopen
- _wexecvpe
- _wexecvp
- _wexecve
- _wexecv
- _wexeclpe
- _wexeclp
- _wexecle
- _wexecl
- _wctime
- _wcsupr
- _wcsset
- _wcsrev
- _wcsnset
- _wcsnicoll
- _wcsnicmp
- _wcsncoll
- _wcslwr
- _wcsicoll
- _wcsicmp
- _wcsdup
- _wcreat
- _wchmod
- _wchdir
- _wasctime
- _waccess
- _vsnwprintf
- _vsnprintf
- _utime
- _unlock
- _unloaddll
- _unlink
- _ungetch
- _umask
- _ultow
- _ultoa
- _ui64tow
- _ui64toa
- _tzset
- _toupper
- _tolower
- _tempnam
- _telli64
- _tell
- _swab
- _sys_nerr
- _strupr
- _strtime
- _strset
- _strrev
- _strnset
- _strnicoll
- _strnicmp
- _strncoll
- _strlwr
- _stricoll
- _stricmp
- _strerror
- _strdup
- _strdate
- _strcmpi
- _statusfp
- _stati64
- _stat
- _splitpath
- _spawnvpe
- _spawnvp
- _spawnve
- _spawnv
- _spawnlpe
- _spawnlp
- _spawnle
- _spawnl
- _sopen
- _snwprintf
- _snprintf
- _sleep
- _setsystime
- _setmode
- _setmbcp
- _setmaxstdio
- _setjmp3
- _setjmp
- _seterrormode
- _set_sbh_threshold
- _set_error_mode
- _seh_longjmp_unwind@4
- _searchenv
- _scalb
- _safe_fprem1
- _safe_fprem
- _safe_fdivr
- _safe_fdiv
- _rotr
- _rotl
- _rmtmp
- _rmdir
- _read
- _putws
- _putw
- _putenv
- _putch
- _purecall
- _popen
- _pipe
- _pclose
- _outpw
- _outpd
- _outp
- _open_osfhandle
- _open
- _nextafter
- _msize
- _mktemp
- _mkdir
- _memicmp
- _memccpy
- _mbsupr
- _mbstrlen
- _mbstok
- _mbsstr
- _mbsspnp
- _mbsspn
- _mbsset
- _mbsrev
- _mbsrchr
- _mbspbrk
- _mbsnset
- _mbsninc
- _mbsnicoll
- _mbsnicmp
- _mbsnextc
- _mbsncpy
- _mbsncoll
- _mbsncmp
- _mbsnccnt
- _mbsncat
- _mbsnbset
- _mbsnbicoll
- _mbsnbicmp
- _mbsnbcpy
- _mbsnbcoll
- _mbsnbcnt
- _mbsnbcmp
- _mbsnbcat
- _mbslwr
- _mbslen
- _mbsinc
- _mbsicoll
- _mbsicmp
- _mbsdup
- _mbsdec
- _mbscspn
- _mbscpy
- _mbscoll
- _mbscmp
- _mbschr
- _mbscat
- _mbsbtype
- _mbctoupper
- _mbctombb
- _mbctolower
- _mbctokata
- _mbctohira
- _mbclen
- _mbcjmstojis
- _mbcjistojms
- _mbccpy
- _mbbtype
- _mbbtombc
- _makepath
- _ltow
- _ltoa
- _lseeki64
- _lseek
- _lsearch
- _lrotr
- _lrotl
- _longjmpex
- _logb
- _locking
- _lock
- _local_unwind2
- _loaddll
- _lfind
- _kbhit
- _jn
- _j1
- _j0
- _itow
- _itoa
- _isnan
- _ismbstrail
- _ismbslead
- _ismbcupper
- _ismbcsymbol
- _ismbcspace
- _ismbcpunct
- _ismbcprint
- _ismbclower
- _ismbclegal
- _ismbcl2
- _ismbcl1
- _ismbcl0
- _ismbckata
- _ismbchira
- _ismbcgraph
- _ismbcdigit
- _ismbcalpha
- _ismbcalnum
- _ismbbtrail
- _ismbbpunct
- _ismbbprint
- _ismbblead
- _ismbbkpunct
- _ismbbkprint
- _ismbbkana
- _ismbbkalnum
- _ismbbgraph
- _ismbbalpha
- _ismbbalnum
- _isctype
- _isatty
- _inpw
- _inpd
- _inp
- _initterm
- _iob
- _i64tow
- _i64toa
- _hypot
- _HUGE
- _heapwalk
- _heapused
- _heapset
- _heapmin
- _heapchk
- _heapadd
- _global_unwind2
- _getws
- _getw
- _getsystime
- _getpid
- _getmbcp
- _getmaxstdio
- _getdrives
- _getdrive
- _getdllprocaddr
- _getdiskfree
- _getdcwd
- _getcwd
- _getche
- _getch
- _get_sbh_threshold
- _get_osfhandle
- _gcvt
- _futime
- _fullpath
- _ftol
- _ftime
- _fstati64
- _fstat
- _fsopen
- _free_osfhnd
- _fputwchar
- _fputchar
- _fpreset
- _fpieee_flt
- _fpclass
- _fmode
- _flushall
- _flsbuf
- _finite
- _findnexti64
- _findnext
- _findfirsti64
- _findfirst
- _findclose
- _fileno
- _filelengthi64
- _filelength
- _filbuf
- _fgetwchar
- _fgetchar
- _fdopen
- _fcvt
- _fcloseall
- _expand
- _exit
- _execvpe
- _execvp
- _execve
- _execv
- _execlpe
- _execlp
- _execle
- _execl
- _except_handler3
- _except_handler2
- _errno
- _eof
- _endthreadex
- _endthread
- _ecvt
- _dup2
- _dup
- _cwait
- _cscanf
- _creat
- _cputs
- _cprintf
- _copysign
- _controlfp
- _control87
- _commit
- _close
- _clearfp
- _chsize
- _chmod
- _chgsign
- _chdrive
- _chdir
- _cgets
- _cexit
- _callnewh
- _cabs
- _c_exit
- _beginthreadex
- _beginthread
- _beep
- _atoldbl
- _atoi64
- _atodbl
- _assert
- _amsg_exit
- _adj_fptan
- _adj_fprem1
- _adj_fprem
- _adj_fpatan
- _adj_fdivr_m64
- _adj_fdivr_m32i
- _adj_fdivr_m32
- _adj_fdivr_m16i
- _adj_fdiv_r
- _adj_fdiv_m64
- _adj_fdiv_m32i
- _adj_fdiv_m32
- _adj_fdiv_m16i
- _access
- _abnormal_termination
- __wgetmainargs
- __unDName
- __toascii
- __threadid
- __threadhandle
- __setusermatherr
- __set_app_type
- __pxcptinfoptrs
- __p__wpgmptr
- __p__winver
- __p__winminor
- __p__winmajor
- __p__wenviron
- __p__wcmdln
- __p__tzname
- __p__timezone
- __p__pwctype
- __p__pgmptr
- __p__pctype
- __p__osver
- __p__mbctype
- __p__mbcasemap
- __p__iob
- __p__fmode
- __p__fileinfo
- __p__environ
- __p__dstbias
- __p__daylight
- __p__commode
- __p__amblksiz
- __p__acmdln
- __p___winitenv
- __p___wargv
- __p___mb_cur_max
- __p___initenv
- __p___argv
- __p___argc
- __lconv_init
- __iscsymf
- __iscsym
- __isascii
- __getmainargs
- __fpecode
- __doserrno
- __dllonexit
- __crtLCMapStringA
- __crtGetLocaleInfoW
- __crtCompareStringA
- __STRINGTOLD
- __RTtypeid
- __RTDynamicCast
- __RTCastToVoid
- __CxxLongjmpUnwind@4
- __CxxFrameHandler
- _XcptFilter
- _Strftime
- _Gettnames
- _Getmonths
- _Getdays
- _EH_prolog
- _CxxThrowException@8
- _CItanh
- _CItan
- _CIsqrt
- _CIsinh
- _CIsin
- _CIpow
- _CIlog10
- _CIlog
- _CIfmod
- _CIexp
- _CIcosh
- _CIcos
- _CIatan2
- _CIatan
- _CIasin
- _CIacos
- $I10_OUTPUT
- _aullshr
- _aullrem
- _aulldiv
- _allshr
- _allshl
- _allrem
- _allmul
- _alldiv
- _setdefaultprecision
- _wsetargv
- _matherr
- _setargv
- __setargv
- _CRT_INIT@12
- _DllMainCRTStartup@12
- _onexit
- atexit
- _alloca_probe
- _chkstk
diff --git a/win32/config.gc b/win32/config.gc
index ac0345f262..ff2da5726b 100644
--- a/win32/config.gc
+++ b/win32/config.gc
@@ -297,8 +297,8 @@ d_statvfs='undef'
d_stdio_cnt_lval='define'
d_stdio_ptr_lval='define'
d_stdio_stream_array='undef'
-d_stdiobase='undef'
-d_stdstdio='undef'
+d_stdiobase='define'
+d_stdstdio='define'
d_strchr='define'
d_strcoll='define'
d_strctcpy='define'
@@ -323,7 +323,7 @@ d_telldirproto='define'
d_time='define'
d_times='define'
d_truncate='undef'
-d_tzname='undef'
+d_tzname='define'
d_umask='define'
d_uname='define'
d_union_semun='define'
@@ -496,7 +496,7 @@ ldflags='~LINK_FLAGS~'
ldlibpthname=''
less='less'
lib_ext='.a'
-libc='libcrtdll.a'
+libc='libmsvcrt.a'
libperl='libperl.a'
libpth=''
libs=''
@@ -691,7 +691,7 @@ uselargefiles='undef'
uselongdouble='undef'
uselonglong='undef'
usemorebits='undef'
-usemultiplicity='define'
+usemultiplicity='undef'
usemymalloc='n'
usenm='false'
useopcode='true'
diff --git a/win32/genmk95.pl b/win32/genmk95.pl
index 6137ce2be6..8fe4f86dbf 100644
--- a/win32/genmk95.pl
+++ b/win32/genmk95.pl
@@ -45,9 +45,12 @@ while (<$in>)
next;
}
else {
- seek ($out, -3, 2); # no recipe, so back up and undo grouping
+ if (!/^\t/) {
+ seek ($out, -4, 2); # no recipe, so back up and undo grouping
+ # should be -3, but MS has its CR/LF thing...
+ $inrec = 0;
+ }
print $out "$_\n";
- $inrec = 0;
next;
}
}
diff --git a/win32/gstartup.c b/win32/gstartup.c
deleted file mode 100644
index fc107e202f..0000000000
--- a/win32/gstartup.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * gstartup.c
- *
- * Startup file for GCC/Mingw32 builds
- * (replaces gcc's default c:\egcs\...\{crt1.o,dllcrt1.o})
- *
- * This file is taken from the Mingw32 package.
- * Created by Colin Peters for Mingw32
- * Modified by Mumit Khan
- *
- * History with Perl:
- * Added (in modified form) to Perl standard distribution to fix
- * problems linking against PerlCRT or MSVCRT
- * -- Benjamin Stuhl <sho_pi@hotmail.com> 10-17-1999
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <io.h>
-#include <fcntl.h>
-#include <process.h>
-#include <float.h>
-#include <windows.h>
-#include <signal.h>
-
-/*
- * Access to a standard 'main'-like argument count and list. Also included
- * is a table of environment variables.
- */
-int _argc;
-char **_argv;
-
-extern int _CRT_glob;
-
-#ifdef __MSVCRT__
-typedef struct {
- int newmode;
-} _startupinfo;
-extern void __getmainargs (int *, char ***, char ***, int, _startupinfo *);
-#else
-extern void __GetMainArgs (int *, char ***, char ***, int);
-#endif
-
-/*
- * Initialize the _argc, _argv and environ variables.
- */
-static void
-_mingw32_init_mainargs ()
-{
- /* The environ variable is provided directly in stdlib.h through
- * a dll function call. */
- char **dummy_environ;
-#ifdef __MSVCRT__
- _startupinfo start_info;
- start_info.newmode = 0;
-#endif
-
- /*
- * Microsoft's runtime provides a function for doing just that.
- */
-#ifdef __MSVCRT__
- (void) __getmainargs (&_argc, &_argv, &dummy_environ, _CRT_glob,
- &start_info);
-#else
- /* CRTDLL version */
- (void) __GetMainArgs (&_argc, &_argv, &dummy_environ, _CRT_glob);
-#endif
-}
-
-#if defined(EXESTARTUP) /* gcrt0.o - startup for an executable */
-
-extern int main (int, char **, char **);
-
-/*
- * Must have the correct app type for MSVCRT.
- */
-
-#ifdef __MSVCRT__
-#define __UNKNOWN_APP 0
-#define __CONSOLE_APP 1
-#define __GUI_APP 2
-__MINGW_IMPORT void __set_app_type(int);
-#endif /* __MSVCRT__ */
-
-/*
- * Setup the default file handles to have the _CRT_fmode mode, as well as
- * any new files created by the user.
- */
-extern unsigned int _CRT_fmode;
-
-static void
-_mingw32_init_fmode ()
-{
- /* Don't set the file mode if the user hasn't set any value for it. */
- if (_CRT_fmode)
- {
- _fmode = _CRT_fmode;
-
- /*
- * This overrides the default file mode settings for stdin,
- * stdout and stderr. At first I thought you would have to
- * test with isatty, but it seems that the DOS console at
- * least is smart enough to handle _O_BINARY stdout and
- * still display correctly.
- */
- if (stdin)
- {
- _setmode (_fileno (stdin), _CRT_fmode);
- }
- if (stdout)
- {
- _setmode (_fileno (stdout), _CRT_fmode);
- }
- if (stderr)
- {
- _setmode (_fileno (stderr), _CRT_fmode);
- }
- }
-}
-
-/* This function will be called when a trap occurs. Thanks to Jacob
- Navia for his contribution. */
-static CALLBACK long
-_gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
-{
- void (*old_handler) (int);
- long action = EXCEPTION_CONTINUE_SEARCH;
- int reset_fpu = 0;
-
- switch (exception_data->ExceptionRecord->ExceptionCode)
- {
- case EXCEPTION_ACCESS_VIOLATION:
- /* test if the user has set SIGSEGV */
- old_handler = signal (SIGSEGV, SIG_DFL);
- if (old_handler == SIG_IGN)
- {
- /* this is undefined if the signal was raised by anything other
- than raise (). */
- signal (SIGSEGV, SIG_IGN);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- else if (old_handler != SIG_DFL)
- {
- /* This means 'old' is a user defined function. Call it */
- (*old_handler) (SIGSEGV);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- break;
-
- case EXCEPTION_FLT_INVALID_OPERATION:
- case EXCEPTION_FLT_DIVIDE_BY_ZERO:
- case EXCEPTION_FLT_DENORMAL_OPERAND:
- case EXCEPTION_FLT_OVERFLOW:
- case EXCEPTION_FLT_UNDERFLOW:
- case EXCEPTION_FLT_INEXACT_RESULT:
- reset_fpu = 1;
- /* fall through. */
-
- case EXCEPTION_INT_DIVIDE_BY_ZERO:
- /* test if the user has set SIGFPE */
- old_handler = signal (SIGFPE, SIG_DFL);
- if (old_handler == SIG_IGN)
- {
- signal (SIGFPE, SIG_IGN);
- if (reset_fpu)
- _fpreset ();
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- else if (old_handler != SIG_DFL)
- {
- /* This means 'old' is a user defined function. Call it */
- (*old_handler) (SIGFPE);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- break;
-
- default:
- break;
- }
- return action;
-}
-
-/*
- * The function mainCRTStartup is the entry point for all console programs.
- */
-static int
-__mingw_CRTStartup ()
-{
- int nRet;
-
- /*
- * Set up the top-level exception handler so that signal handling
- * works as expected. The mapping between ANSI/POSIX signals and
- * Win32 SE is not 1-to-1, so caveat emptore.
- *
- */
- SetUnhandledExceptionFilter (_gnu_exception_handler);
-
- /*
- * Initialize floating point unit.
- */
- _fpreset (); /* Supplied by the runtime library. */
-
- /*
- * Set up __argc, __argv and _environ.
- */
- _mingw32_init_mainargs ();
-
- /*
- * Sets the default file mode for stdin, stdout and stderr, as well
- * as files later opened by the user, to _CRT_fmode.
- * NOTE: DLLs don't do this because that would be rude!
- */
- _mingw32_init_fmode ();
-
- /*
- * Call the main function. If the user does not supply one
- * the one in the 'libmingw32.a' library will be linked in, and
- * that one calls WinMain. See main.c in the 'lib' dir
- * for more details.
- */
- nRet = main (_argc, _argv, environ);
-
- /*
- * Perform exit processing for the C library. This means
- * flushing output and calling 'atexit' registered functions.
- */
- _cexit ();
-
- ExitProcess (nRet);
-
- return 0;
-}
-
-/*
- * The function mainCRTStartup is the entry point for all console programs.
- */
-int
-mainCRTStartup ()
-{
-#ifdef __MSVCRT__
- __set_app_type (__CONSOLE_APP);
-#endif
- __mingw_CRTStartup ();
- return 0;
-}
-
-/*
- * For now the GUI startup function is the same as the console one.
- * This simply gets rid of the annoying warning about not being able
- * to find WinMainCRTStartup when linking GUI applications.
- */
-int
-WinMainCRTStartup ()
-{
-#ifdef __MSVCRT__
- __set_app_type (__GUI_APP);
-#endif
- __mingw_CRTStartup ();
-}
-
-#elif defined(DLLSTARTUP) /* dllcrt0.o - startup for a DLL */
-
-/* Unlike normal crt1, I don't initialize the FPU, because the process
- * should have done that already. I also don't set the file handle modes,
- * because that would be rude. */
-
-#ifdef __GNUC__
-extern void __main ();
-extern void __do_global_dtors ();
-#endif
-
-extern BOOL WINAPI DllMain (HANDLE, DWORD, LPVOID);
-
-BOOL WINAPI
-DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
-{
- BOOL bRet;
-
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- _mingw32_init_mainargs ();
-
-#ifdef __GNUC__
- /* From libgcc.a, calls global class constructors. */
- __main ();
-#endif
- }
-
- /*
- * Call the user-supplied DllMain subroutine
- * NOTE: DllMain is optional, so libmingw32.a includes a stub
- * which will be used if the user does not supply one.
- */
- bRet = DllMain (hDll, dwReason, lpReserved);
-
-#ifdef __GNUC__
- if (dwReason == DLL_PROCESS_DETACH)
- {
- /* From libgcc.a, calls global class destructors. */
- __do_global_dtors ();
- }
-#endif
-
- return bRet;
-}
-
-/*
- * For the moment a dummy atexit. Atexit causes problems in DLLs, especially
- * if they are dynamically loaded. For now atexit inside a DLL does nothing.
- * NOTE: We need this even if the DLL author never calls atexit because
- * the global constructor function __do_global_ctors called from __main
- * will attempt to register __do_global_dtors using atexit.
- * Thanks to Andrey A. Smirnov for pointing this one out.
- */
-int
-atexit (void (*pfn) ())
-{
- return 0;
-}
-
-#else
-#error No startup target!
-#endif /* EXESTARTUP */
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 3b6439594b..228edca8d2 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1,9 +1,9 @@
#
# Makefile to build perl on Windows NT using DMAKE.
# Supported compilers:
-# Visual C++ 2.0 thro 5.0
+# Visual C++ 2.0 thro 6.0
# Borland C++ 5.02
-# Mingw32 with gcc-2.8.1 or egcs-1.0.2 **experimental**
+# Mingw32 with gcc-2.95.2 or better **experimental**
#
# This is set up to build a perl.exe that runs off a shared library
# (perl.dll). Also makes individual DLLs for the XS extensions.
@@ -81,6 +81,7 @@ INST_ARCH *= \$(ARCHNAME)
#
# uncomment to enable the implicit "host" layer for all system calls
# made by perl. This is needed and auto-enabled by USE_OBJECT above.
+# This is also needed to get fork().
#
#USE_IMP_SYS *= define
@@ -95,7 +96,7 @@ INST_ARCH *= \$(ARCHNAME)
#CCTYPE *= MSVC60
# Borland 5.02 or later
CCTYPE *= BORLAND
-# mingw32/egcs or mingw32/gcc
+# mingw32/gcc-2.95.2 or better
#CCTYPE *= GCC
#
@@ -111,10 +112,9 @@ CCTYPE *= BORLAND
#CFG *= Debug
#
-# uncomment to enable use of PerlCRT.DLL when using the Visual C compiler
-# or GCC/Mingw32. Highly recommended. It has patches that fix known bugs in
-# MSVCRT.DLL. This currently requires VC 5.0 with Service Pack 3 or later
-# or GCC/Mingw32.
+# uncomment to enable use of PerlCRT.DLL when using the Visual C compiler.
+# It has patches that fix known bugs in older versions of MSVCRT.DLL.
+# This currently requires VC 5.0 with Service Pack 3 or later.
# Get it from CPAN at http://www.perl.com/CPAN/authors/id/D/DO/DOUGL/
# and follow the directions in the package to install.
#
@@ -181,7 +181,11 @@ CCLIBDIR *= $(CCHOME)\lib
#
#BUILDOPT += -DPERL_EXTERNAL_GLOB
-# Enabling this runs a cloned toplevel interpreter (fails tests)
+# Enabling this causes perl to do its own CR/LF conversions, and is required
+# if you want to be able to use the bytecode compiler and ByteLoader
+BUILDOPT += -DUSE_BINMODE_SCRIPTS
+
+# Enabling this runs a cloned toplevel interpreter (*EXPERIMENTAL*, fails tests)
#BUILDOPT += -DTOP_CLONE
#
@@ -348,30 +352,21 @@ a = .a
# Options
#
-# GCC headers need to know that we're using MSVCRT (or a clone thereof)
-RUNTIME = -D__MSVCRT__
+RUNTIME =
INCLUDES = -I$(COREDIR) -I.\include -I. -I..
DEFINES = -DWIN32 $(CRYPT_FLAG)
LOCDEFS = -DPERLDLL -DPERL_CORE
SUBSYS = console
CXX_FLAG = -xc++
-.IF "$(USE_PERLCRT)" == ""
-LIBCDLL = msvcrt.dll
-CRTIMPLIBS = $(OLDNAMES_A)
-.ELSE
-LIBCDLL = PerlCRT.dll
-CRTIMPLIBS = $(PERLCRT_A) $(OLDNAMES_A)
-.ENDIF
-
-LIBC = -l$(LIBCDLL:s/.dll//)
-GCCLIBS = -lmingw32 -lgcc
+LIBC = -lmsvcrt
-# same libs as MSVC, but no -luuid32 or -lodbccp32 yet
-LIBFILES = $(GCCLIBS) $(CRYPT_LIB) $(LIBC) -loldnames -lkernel32 \
- -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 \
- -lole32 -loleaut32 -lnetapi32 -lwsock32 -lmpr -lwinmm \
- -lversion -lodbc32
+# same libs as MSVC
+LIBFILES = $(CRYPT_LIB) $(LIBC) \
+ -lmoldname -lkernel32 -luser32 -lgdi32 \
+ -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 \
+ -loleaut32 -lnetapi32 -luuid -lwsock32 -lmpr \
+ -lwinmm -lversion -lodbc32
.IF "$(CFG)" == "Debug"
OPTIMIZE = -g $(RUNTIME) -DDEBUGGING
@@ -387,9 +382,6 @@ OBJOUT_FLAG = -o
EXEOUT_FLAG = -o
LIBOUT_FLAG =
-# tack COREDIR on for perl build
-PRIV_LINK_FLAGS = -L"$(COREDIR)"
-
.ELSE
CC = cl
@@ -475,16 +467,11 @@ OPTIMIZE += $(CXX_FLAG)
BUILDOPT += -DPERL_OBJECT
.ENDIF
-CRTIMPLIBS *= __not_needed
-PERLCRT_A *= $(COREDIR)\libPerlCRT.a
-PERLCRT_DEF *= PerlCRT.def
-OLDNAMES_A *= $(COREDIR)\liboldnames.a
-OLDNAMES_DEF *= oldnames.def
-
CFLAGS_O = $(CFLAGS) $(BUILDOPT)
-# used to allow local linking flags that are not propogated into Config.pm
-# -- BKS, 11-15-1999
+# used to allow local linking flags that are not propogated into Config.pm,
+# currently unused
+# -- BKS, 12-12-1999
PRIV_LINK_FLAGS *=
BLINK_FLAGS = $(PRIV_LINK_FLAGS) $(LINK_FLAGS)
@@ -515,7 +502,7 @@ $(o).dll:
$(IMPLIB) $(*B).lib $@
.ELIF "$(CCTYPE)" == "GCC"
$(LINK32) -o $@ $(BLINK_FLAGS) $< $(LIBFILES)
- $(IMPLIB) -def $(*B).def $(*B).a $@
+ $(IMPLIB) --input-def $(*B).def --output-lib $(*B).a $@
.ELSE
$(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \
-out:$@ $(BLINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
@@ -734,12 +721,6 @@ X2P_OBJ = $(X2P_SRC:db:+$(o))
PERLDLL_OBJ = $(CORE_OBJ)
PERLEXE_OBJ = perlmain$(o)
-.IF "$(CCTYPE)" == "GCC"
-PERLEXE_OBJ += .\gcrt0$(o)
-MINI_OBJ += $(MINIDIR)\gcrt0$(o)
-DLL_OBJ += .\gdllcrt0$(o)
-.ENDIF
-
PERLDLL_OBJ += $(WIN32_OBJ) $(DLL_OBJ)
.IF "$(USE_SETARGV)" != ""
@@ -877,7 +858,7 @@ RIGHTMAKE = __not_needed
# Top targets
#
-all : $(CRTIMPLIBS) .\config.h $(GLOBEXE) $(MINIPERL) $(MK2) \
+all : .\config.h $(GLOBEXE) $(MINIPERL) $(MK2) \
$(RIGHTMAKE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) \
$(X2P) $(EXTENSION_DLL) $(EXTENSION_PM)
@@ -889,7 +870,7 @@ $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
# this target is a jump-off point for Win95
# 1. it switches to the Win95-specific makefile if it exists
-# (__do_switc_makefiles)
+# (__do_switch_makefiles)
# 2. it prints a message when the Win95-specific one finishes (__done)
# 3. it then kills this makefile by trying to make __no_such_target
@@ -925,36 +906,6 @@ __no_such_target:
#--------------------- END Win95 SPECIFIC ---------------------
-#--------------------- BEGIN GCC/Mingw32 SPECIFIC -------------
-
-# make GCC-ish implib for PerlCRT.dll if needed
-$(PERLCRT_A): $(PERLCRT_DEF)
- if not exist $(COREDIR) mkdir $(COREDIR)
- $(IMPLIB) --def $(PERLCRT_DEF) \
- --dllname $(LIBCDLL) \
- --output-lib $(PERLCRT_A)
-
-# make GCC-ish oldnames implib for our CRT (whether it's MSVCRT or PerlCRT)
-$(OLDNAMES_A): $(OLDNAMES_DEF)
- $(IMPLIB) --def $(OLDNAMES_DEF) \
- --dllname $(LIBCDLL) \
- --output-lib $(OLDNAMES_A) \
- --add-underscore
-
-# MSVCRT-using runtime startup files
-$(MINIDIR)\gcrt0$(o): .\gstartup.c
- $(CC) -c $(CFLAGS) -DEXESTARTUP $(OBJOUT_FLAG)$@ .\gstartup.c
-
-.\gcrt0$(o): .\gstartup.c
- $(CC) -c $(CFLAGS) -DEXESTARTUP $(OBJOUT_FLAG)$@ .\gstartup.c
-
-.\gdllcrt0$(o): .\gstartup.c
- $(CC) -c $(CFLAGS) -DDLLSTARTUP $(OBJOUT_FLAG)$@ .\gstartup.c
- $(XCOPY) $@ $(COREDIR)
-
-
-#--------------------- END GCC/Mingw32 SPECIFIC ---------------
-
# a blank target for when builds don't need to do certain things
# this target added for Win95 port but used to keep the WinNT port able to
# use this file
@@ -967,7 +918,7 @@ $(GLOBEXE) : perlglob$(o)
$(LINK32) -Tpe -ap $(BLINK_FLAGS) c0x32$(o) perlglob$(o) \
"$(CCLIBDIR)\32BIT\wildargs$(o)",$@,,import32.lib cw32mt.lib,
.ELIF "$(CCTYPE)" == "GCC"
- $(LINK32) $(BLINK_FLAGS) -o $@ perlglob$(o) $(LIBFILES)
+ $(LINK32) $(BLINK_FLAGS) -mconsole -o $@ perlglob$(o) $(LIBFILES)
.ELSE
$(LINK32) $(BLINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
perlglob$(o) setargv$(o)
@@ -1013,7 +964,7 @@ $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(CRTIPMLIBS)
$(LINK32) -Tpe -ap $(BLINK_FLAGS) \
@$(mktmp c0x32$(o) $(MINI_OBJ:s,\,\\),$(@:s,\,\\),,$(LIBFILES),)
.ELIF "$(CCTYPE)" == "GCC"
- $(LINK32) -v -nostdlib -o $@ $(BLINK_FLAGS) \
+ $(LINK32) -v -mconsole -o $@ $(BLINK_FLAGS) \
$(mktmp $(LKPRE) $(MINI_OBJ:s,\,\\) $(LIBFILES) $(LKPOST))
.ELSE
$(LINK32) -subsystem:console -out:$@ \
@@ -1030,9 +981,13 @@ $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
$(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*B).c
# -DPERL_IMPLICIT_SYS needs C++ for perllib.c
-.IF "$(USE_IMP_SYS)$(USE_OBJECT)" == "defineundef"
+# rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless
+# unless the .IF is true), so instead we use a .ELSE with the default
perllib$(o) : perllib.c
+.IF "$(USE_IMP_SYS)$(USE_OBJECT)" == "defineundef"
$(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ perllib.c
+.ELSE
+ $(CC) -c -I. $(CFLAGS_O) $(OBJOUT_FLAG)$@ perllib.c
.ENDIF
# 1. we don't want to rebuild miniperl.exe when config.h changes
@@ -1061,10 +1016,10 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES)
$(LINK32) -mdll -o $@ -Wl,--base-file -Wl,perl.base $(BLINK_FLAGS) \
$(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,\\) $(LIBFILES) $(LKPOST))
dlltool --output-lib $(PERLIMPLIB) \
- --dllname $(PERLDLL:b).dll \
- --def perldll.def \
- --base-file perl.base \
- --output-exp perl.exp
+ --dllname $(PERLDLL:b).dll \
+ --def perldll.def \
+ --base-file perl.base \
+ --output-exp perl.exp
$(LINK32) -mdll -o $@ $(BLINK_FLAGS) \
$(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,\\) $(LIBFILES) \
perl.exp $(LKPOST))
@@ -1119,7 +1074,7 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
$(@:s,\,\\),\n \
$(PERLIMPLIB) $(LIBFILES)\n)
.ELIF "$(CCTYPE)" == "GCC"
- $(LINK32) -nostdlib -o $@ $(BLINK_FLAGS) \
+ $(LINK32) -mconsole -o $@ $(BLINK_FLAGS) \
$(PERLEXE_OBJ) $(PERLIMPLIB) $(LIBFILES)
.ELSE
$(LINK32) -subsystem:console -out:$@ $(BLINK_FLAGS) $(LIBFILES) \
diff --git a/win32/oldnames.def b/win32/oldnames.def
deleted file mode 100644
index a6ffd34a6f..0000000000
--- a/win32/oldnames.def
+++ /dev/null
@@ -1,115 +0,0 @@
-;
-; oldnames.def
-;
-; oldnames versions of MSVCRT/PerlCRT functions for GCC/Mingw32
-;
-; This file is taken from the Mingw32 distribution
-; Created by Colin Peters for Mingw32
-;
-; Added to Perl5 distrbution by Benjamin Stuhl <sho_pi@hotmail.com>
-
-EXPORTS
-access
-beep
-cabs
-chdir
-chmod
-chsize
-close
-creat
-cwait
-dup
-dup2
-ecvt
-eof
-execl
-execle
-execlp
-execlpe
-execv
-execve
-execvp
-execvpe
-fcvt
-fdopen
-fgetchar
-fgetwchar
-filelength
-fileno
-fputchar
-fputwchar
-fstat
-ftime
-gcvt
-getch
-getche
-getcwd
-getpid
-getw
-heapwalk
-hypot
-isatty
-itoa
-j0
-j1
-jn
-kbhit
-lseek
-ltoa
-memccpy
-memicmp
-mkdir
-mktemp
-open
-pclose
-popen
-putch
-putenv
-putw
-read
-rmdir
-searchenv
-seterrormode
-setmode
-sleep
-sopen
-spawnl
-spawnle
-spawnlp
-spawnlpe
-spawnv
-spawnve
-spawnvp
-spawnvpe
-stat
-strcmpi
-strdup
-stricmp
-stricoll
-strlwr
-strnicmp
-strnset
-strrev
-strset
-strupr
-swab
-tell
-tempnam
-tzset
-umask
-ungetch
-unlink
-utime
-wcsdup
-wcsicmp
-wcsicoll
-wcslwr
-wcsnicmp
-wcsnset
-wcsrev
-wcsset
-wcsupr
-write
-y0
-y1
-yn
diff --git a/win32/perlhost.h b/win32/perlhost.h
index 01ff73d0f3..15f03c6597 100644
--- a/win32/perlhost.h
+++ b/win32/perlhost.h
@@ -1668,7 +1668,7 @@ win32_start_child(LPVOID arg)
{
dJMPENV;
- volatile oldscope = PL_scopestack_ix;
+ volatile int oldscope = PL_scopestack_ix;
restart:
JMPENV_PUSH(status);
diff --git a/win32/perllib.c b/win32/perllib.c
index 1b8516c502..9ccf5a0043 100644
--- a/win32/perllib.c
+++ b/win32/perllib.c
@@ -404,7 +404,7 @@ DllMain(HANDLE hModule, /* DLL module handle */
_fmode = O_BINARY;
#endif
g_TlsAllocIndex = TlsAlloc();
- DisableThreadLibraryCalls(hModule);
+ DisableThreadLibraryCalls((HMODULE)hModule);
w32_perldll_handle = hModule;
break;
diff --git a/win32/runperl.c b/win32/runperl.c
index 8e6b249b44..85fd831759 100644
--- a/win32/runperl.c
+++ b/win32/runperl.c
@@ -2,10 +2,6 @@
#include "perl.h"
#ifdef __GNUC__
-/*
- * GNU C does not do __declspec()
- */
-#define __declspec(foo)
/* Mingw32 defaults to globing command line
* This is inconsistent with other Win32 ports and
diff --git a/win32/win32.c b/win32/win32.c
index 4fcf6aa6bb..ae22a60927 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -15,6 +15,8 @@
#define Win32_Winsock
#endif
#include <windows.h>
+#include <winnt.h>
+#include <io.h>
/* #include "config.h" */
diff --git a/win32/win32.h b/win32/win32.h
index 50b4f1936c..c953f5b38e 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -9,7 +9,9 @@
#ifndef _INC_WIN32_PERL5
#define _INC_WIN32_PERL5
-#define _WIN32_WINNT 0x0400 /* needed for TryEnterCriticalSection() etc. */
+#ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0400 /* needed for TryEnterCriticalSection() etc. */
+#endif
#if defined(PERL_OBJECT) || defined(PERL_IMPLICIT_SYS) || defined(PERL_CAPI)
# define DYNAMIC_ENV_FETCH
@@ -35,18 +37,6 @@
# define __int64 long long
# endif
# define Win32_Winsock
-/* GCC does not do __declspec() - render it a nop
- * and turn on options to avoid importing data
- */
-#ifndef __declspec
-# define __declspec(x)
-#endif
-# ifndef PERL_OBJECT
-# define PERL_GLOBAL_STRUCT
-# ifndef MULTIPLICITY
-# define MULTIPLICITY
-# endif
-# endif
#endif
/* Define DllExport akin to perl's EXT,
@@ -55,6 +45,8 @@
* otherwise import it.
*/
+/* now even GCC supports __declspec() */
+
#if defined(PERL_OBJECT)
#define DllExport
#else
@@ -251,9 +243,6 @@ typedef long gid_t;
#define flushall _flushall
#define fcloseall _fcloseall
-#undef __attribute__
-#define __attribute__(x)
-
#ifndef CP_UTF8
# define CP_UTF8 65001
#endif