diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/Makefile | 2 | ||||
-rw-r--r-- | win32/makefile.mk | 7 | ||||
-rw-r--r-- | win32/win32.c | 37 | ||||
-rw-r--r-- | win32/win32.h | 7 |
4 files changed, 37 insertions, 16 deletions
diff --git a/win32/Makefile b/win32/Makefile index d669516974..f5ee4c6482 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -972,6 +972,8 @@ utils: $(PERLEXE) $(X2P) copy ..\vms\perlvms.pod .\perlvms.pod copy ..\README.win32 .\perlwin32.pod $(MAKE) -f ..\win32\pod.mak converters + cd ..\lib + $(PERLEXE) lib.pm.PL cd ..\win32 $(PERLEXE) $(PL2BAT) $(UTILS) diff --git a/win32/makefile.mk b/win32/makefile.mk index 21836b22ec..24ad173df5 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -1005,14 +1005,15 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) perldll.def\n) $(IMPLIB) $*.lib $@ .ELIF "$(CCTYPE)" == "GCC" - $(LINK32) -mdll -o $@ -Wl,--base-file -Wl,perl.base $(BLINK_FLAGS) \ + $(LINK32) -mdll -o $@ -Wl,--base-file,perl.base \ + -Wl,--image-base,0x28000000 $(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 - $(LINK32) -mdll -o $@ $(BLINK_FLAGS) \ + $(LINK32) -mdll -o $@ -Wl,--image-base,0x28000000 $(BLINK_FLAGS) \ $(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,\\) $(LIBFILES) \ perl.exp $(LKPOST)) .ELSE @@ -1067,7 +1068,7 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES) $(@:s,\,\\),\n \ $(PERLIMPLIB) $(LIBFILES)\n) .ELIF "$(CCTYPE)" == "GCC" - $(LINK32) -mconsole -o $@ $(BLINK_FLAGS) \ + $(LINK32) -mconsole -o $@ -Wl,--stack,0x800000 $(BLINK_FLAGS) \ $(PERLEXE_OBJ) $(PERLIMPLIB) $(LIBFILES) .ELSE $(LINK32) -subsystem:console -out:$@ -stack:0x1000000 $(BLINK_FLAGS) \ diff --git a/win32/win32.c b/win32/win32.c index 1ba2e51758..a4e1a7938b 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -15,11 +15,6 @@ #define Win32_Winsock #endif #include <windows.h> -#ifndef __MINGW32__ /* GCC/Mingw32-2.95.2 forgot the WINAPI on CommandLineToArgvW() */ -# include <shellapi.h> -#else - LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCommandLine, int * pNumArgs); -#endif #include <winnt.h> #include <io.h> @@ -46,6 +41,7 @@ #endif #include <string.h> #include <stdarg.h> +#include <stdlib.h> /* get a real declaration of sys_nerr */ #include <float.h> #include <time.h> #if defined(_MSC_VER) || defined(__MINGW32__) @@ -1613,7 +1609,11 @@ win32_uname(struct utsname *name) GetSystemInfo(&info); #if defined(__BORLANDC__) || defined(__MINGW32__) - switch (info.u.s.wProcessorArchitecture) { +#ifndef _STRUCT_NAME +# define _STRUCT_NAME(s) s +# define _UNION_NAME(u) u +#endif + switch (info._UNION_NAME(u.)_STRUCT_NAME(s.)wProcessorArchitecture) { #else switch (info.wProcessorArchitecture) { #endif @@ -2057,9 +2057,6 @@ win32_feof(FILE *fp) DllExport char * win32_strerror(int e) { -#ifndef __BORLANDC__ /* Borland intolerance */ - extern int sys_nerr; -#endif DWORD source = 0; if (e < 0 || e > sys_nerr) { @@ -2393,7 +2390,9 @@ win32_popen(const char *command, const char *mode) /* close saved handle */ win32_close(oldfd); + LOCK_FDPID_MUTEX; sv_setiv(*av_fetch(w32_fdpid, p[parent], TRUE), childpid); + UNLOCK_FDPID_MUTEX; /* set process id so that it can be returned by perl's open() */ PL_forkprocess = childpid; @@ -2429,7 +2428,9 @@ win32_pclose(FILE *pf) int childpid, status; SV *sv; + LOCK_FDPID_MUTEX; sv = *av_fetch(w32_fdpid, win32_fileno(pf), TRUE); + if (SvIOK(sv)) childpid = SvIVX(sv); else @@ -2442,6 +2443,7 @@ win32_pclose(FILE *pf) win32_fclose(pf); SvIVX(sv) = 0; + UNLOCK_FDPID_MUTEX; if (win32_waitpid(childpid, &status, 0) == -1) return -1; @@ -2489,8 +2491,8 @@ Nt4CreateHardLinkW( StreamId.dwStreamAttributes = 0; StreamId.dwStreamNameSize = 0; #if defined(__BORLANDC__) || defined(__MINGW32__) - StreamId.Size.u.HighPart = 0; - StreamId.Size.u.LowPart = dwLen; + StreamId.Size._UNION_NAME(u.)HighPart = 0; + StreamId.Size._UNION_NAME(u.)LowPart = dwLen; #else StreamId.Size.HighPart = 0; StreamId.Size.LowPart = dwLen; @@ -4098,13 +4100,21 @@ win32_free_argvw(pTHXo_ void *ptr) } } +typedef LPWSTR* (WINAPI CLTARGVW)(LPCWSTR lpCommandLine, int * pNumArgs); +/* load shell32.dll on demand (reduces number of DLLs loaded on startup by 1/3) + -- BKS 5-28-2000 */ void win32_argv2utf8(int argc, char** argv) { dTHXo; char* psz; int length, wargc; - LPWSTR* lpwStr = CommandLineToArgvW(GetCommandLineW(), &wargc); + HANDLE hDll = LoadLibraryA("shell32.dll"); + CLTARGVW *pCommandLineToArgvW = NULL; + LPWSTR* lpwStr = NULL; + if (hDll && (pCommandLineToArgvW = (CLTARGVW*)GetProcAddress(hDll, "CommandLineToArgvW"))) { + lpwStr = (*pCommandLineToArgvW)(GetCommandLineW(), &wargc); + } if (lpwStr && argc) { while (argc--) { length = WideCharToMultiByte(CP_UTF8, 0, lpwStr[--wargc], -1, NULL, 0, NULL, NULL); @@ -4114,6 +4124,7 @@ win32_argv2utf8(int argc, char** argv) } call_atexit(win32_free_argvw, argv); } + if (hDll) + FreeLibrary(hDll); GlobalFree((HGLOBAL)lpwStr); } - diff --git a/win32/win32.h b/win32/win32.h index 3929bcc15c..2e5b0740dd 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -135,6 +135,12 @@ struct utsname { #define USE_FIXED_OSFHANDLE #endif +/* Define PERL_WIN32_SOCK_DLOAD to have Perl dynamically load the winsock + DLL when needed. Don't use if your compiler supports delayloading (ie, VC++ 6.0) + -- BKS 5-29-2000 */ +#if !(defined(_M_IX86) && _MSC_VER >= 1200) +#define PERL_WIN32_SOCK_DLOAD +#endif #define ENV_IS_CASELESS #ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers don't have this */ @@ -213,6 +219,7 @@ typedef long gid_t; #endif #define flushall _flushall #define fcloseall _fcloseall +#define isnan _isnan /* ...same libraries as MSVC */ #ifdef PERL_OBJECT # define MEMBER_TO_FPTR(name) &(name) |