s = argv[0]+1;
reswitch:
switch (*s) {
+ case 'C':
+#ifdef WIN32
+ win32_argv2utf8(aTHX_ argc-1, argv+1);
+ /* FALL THROUGH */
+#endif
#ifndef PERL_STRICT_CR
case '\r':
#endif
case ' ':
case '0':
- case 'C':
case 'F':
case 'a':
case 'c':
(void)gv_AVadd(PL_argvgv);
av_clear(GvAVn(PL_argvgv));
for (; argc > 0; argc--,argv++) {
- av_push(GvAVn(PL_argvgv),newSVpv(argv[0],0));
+ SV *sv = newSVpv(argv[0],0);
+ av_push(GvAVn(PL_argvgv),sv);
+ if (PL_widesyscalls)
+ sv_utf8_upgrade(sv);
}
}
if (PL_envgv = gv_fetchpv("ENV",TRUE, SVt_PVHV)) {
# VC 6.0 can load the socket dll on demand. Makes the test suite
# run in about 10% less time.
-DELAYLOAD = -DELAYLOAD:wsock32.dll delayimp.lib
+DELAYLOAD = -DELAYLOAD:wsock32.dll -DELAYLOAD:shell32.dll delayimp.lib
# VC 6.0 seems capable of compiling perl correctly with optimizations
# enabled. Anything earlier fails tests.
$(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES)
$(LINK32) -dll -def:perldll.def -out:$@ @<<
- $(LINK_FLAGS) $(LIBFILES) $(PERLDLL_OBJ) $(PERLDLL_RES)
+ $(LINK_FLAGS) /base:0x28000000 $(LIBFILES) $(PERLDLL_OBJ) $(PERLDLL_RES)
<<
$(XCOPY) $(PERLIMPLIB) $(COREDIR)
# VC 6.0 can load the socket dll on demand. Makes the test suite
# run in about 10% less time.
-DELAYLOAD *= -DELAYLOAD:wsock32.dll delayimp.lib
+DELAYLOAD *= -DELAYLOAD:wsock32.dll -DELAYLOAD:shell32.dll delayimp.lib
# VC 6.0 seems capable of compiling perl correctly with optimizations
# enabled. Anything earlier fails tests.
perl.exp $(LKPOST))
.ELSE
$(LINK32) -dll -def:perldll.def -out:$@ \
- @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(PERLDLL_RES) $(PERLDLL_OBJ:s,\,\\))
+ @$(mktmp $(BLINK_FLAGS) $(LIBFILES) /base:0x28000000 $(PERLDLL_RES) $(PERLDLL_OBJ:s,\,\\))
.ENDIF
$(XCOPY) $(PERLIMPLIB) $(COREDIR)
#define Win32_Winsock
#endif
#include <windows.h>
+#include <shellapi.h>
#include <winnt.h>
#include <io.h>
}
#endif
+static void
+win32_free_argvw(pTHXo_ void *ptr)
+{
+ char** argv = (char**)ptr;
+ while(*argv) {
+ Safefree(*argv);
+ *argv++ = Nullch;
+ }
+}
+
+void
+win32_argv2utf8(pTHX_ int argc, char** argv)
+{
+ char* psz;
+ int length, wargc;
+ LPWSTR* lpwStr = CommandLineToArgvW(GetCommandLineW(), &wargc);
+ if (lpwStr && argc) {
+ while (argc--) {
+ length = WideCharToMultiByte(CP_UTF8, 0, lpwStr[--wargc], -1, NULL, 0, NULL, NULL);
+ Newz(0, psz, length, char);
+ WideCharToMultiByte(CP_UTF8, 0, lpwStr[wargc], -1, psz, length, NULL, NULL);
+ argv[argc] = psz;
+ }
+ call_atexit(win32_free_argvw, argv);
+ }
+ GlobalFree((HGLOBAL)lpwStr);
+}
+
extern char * win32_get_sitelib(char *pl);
extern int IsWin95(void);
extern int IsWinNT(void);
+extern void win32_argv2utf8(pTHX_ int argc, char** argv);
extern char * staticlinkmodules[];