This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Enable new wcs variables for Win32
[perl5.git] / win32 / perllib.c
index ff21210..0e44a24 100644 (file)
@@ -18,7 +18,7 @@
 
 
 /* Register any extra external extensions */
-char *staticlinkmodules[] = {
+const char * const staticlinkmodules[] = {
     "DynaLoader",
     /* other similar records will be included from "perllibst.h" */
 #define STATIC1
@@ -211,31 +211,19 @@ RunPerl(int argc, char **argv, char **env)
 {
     int exitstatus;
     PerlInterpreter *my_perl, *new_perl = NULL;
-    OSVERSIONINFO osver;
-    char szModuleName[MAX_PATH];
     char *arg0 = argv[0];
     char *ansi = NULL;
     bool use_environ = (env == environ);
 
-    osver.dwOSVersionInfoSize = sizeof(osver);
-    GetVersionEx(&osver);
-
-    if (osver.dwMajorVersion > 4) {
-        WCHAR widename[MAX_PATH];
-        GetModuleFileNameW(NULL, widename, sizeof(widename)/sizeof(WCHAR));
-        argv[0] = ansi = win32_ansipath(widename);
-    }
-    else {
-        Win_GetModuleFileName(NULL, szModuleName, sizeof(szModuleName));
-        (void)win32_longpath(szModuleName);
-        argv[0] = szModuleName;
-    }
+    WCHAR widename[MAX_PATH];
+    GetModuleFileNameW(NULL, widename, sizeof(widename)/sizeof(WCHAR));
+    argv[0] = ansi = win32_ansipath(widename);
 
 #ifdef PERL_GLOBAL_STRUCT
-#define PERLVAR(var,type) /**/
-#define PERLVARA(var,type) /**/
-#define PERLVARI(var,type,init) PL_Vars.var = init;
-#define PERLVARIC(var,type,init) PL_Vars.var = init;
+#define PERLVAR(prefix,var,type) /**/
+#define PERLVARA(prefix,var,type) /**/
+#define PERLVARI(prefix,var,type,init) PL_Vars.prefix##var = init;
+#define PERLVARIC(prefix,var,type,init) PL_Vars.prefix##var = init;
 #include "perlvars.h"
 #undef PERLVAR
 #undef PERLVARA
@@ -281,7 +269,7 @@ RunPerl(int argc, char **argv, char **env)
     }
 #endif
 
-    /* At least the Borland RTL wants to free argv[] after main() returns. */
+    /* Some RTLs may want to free argv[] after main() returns. */
     argv[0] = arg0;
     if (ansi)
         win32_free(ansi);
@@ -302,7 +290,7 @@ EndSockets(void);
 EXTERN_C               /* GCC in C++ mode mangles the name, otherwise */
 #endif
 BOOL APIENTRY
-DllMain(HANDLE hModule,                /* DLL module handle */
+DllMain(HINSTANCE hModule,     /* DLL module handle */
        DWORD fdwReason,        /* reason called */
        LPVOID lpvReserved)     /* reserved */
 { 
@@ -311,14 +299,6 @@ DllMain(HANDLE hModule,            /* DLL module handle */
         * initialization or a call to LoadLibrary.
         */
     case DLL_PROCESS_ATTACH:
-/* #define DEFAULT_BINMODE */
-#ifdef DEFAULT_BINMODE
-       setmode( fileno( stdin  ), O_BINARY );
-       setmode( fileno( stdout ), O_BINARY );
-       setmode( fileno( stderr ), O_BINARY );
-       _fmode = O_BINARY;
-#endif
-
 #ifndef UNDER_CE
        DisableThreadLibraryCalls((HMODULE)hModule);
 #endif