summaryrefslogtreecommitdiff
path: root/win32/runperl.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-02-01 06:27:35 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-02-01 06:27:35 +0000
commit80252599d4b7fb26eec4e3a0f451b4387c5dcc19 (patch)
treeaf33a52bae818e292c641108bbbc11b8b1b4f8c2 /win32/runperl.c
parent34f744a4168d1ae5fad32a9241fb076a6b2c3fa8 (diff)
downloadperl-80252599d4b7fb26eec4e3a0f451b4387c5dcc19.tar.gz
various win32-ish changes merged from maint-5.005
p4raw-id: //depot/perl@2746
Diffstat (limited to 'win32/runperl.c')
-rw-r--r--win32/runperl.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/win32/runperl.c b/win32/runperl.c
index 3947f9ef37..8cf521d4ea 100644
--- a/win32/runperl.c
+++ b/win32/runperl.c
@@ -1,9 +1,8 @@
-
-#ifdef PERL_OBJECT
-#define USE_SOCKETS_AS_HANDLES
#include "EXTERN.h"
#include "perl.h"
+#ifdef PERL_OBJECT
+
#define NO_XSLOCKS
#include "XSUB.H"
#include "win32iop.h"
@@ -37,8 +36,17 @@ main(int argc, char **argv, char **env)
{
CPerlHost host;
int exitstatus = 1;
+#ifndef __BORLANDC__
+ /* XXX this _may_ be a problem on some compilers (e.g. Borland) that
+ * want to free() argv after main() returns. As luck would have it,
+ * Borland's CRT does the right thing to argv[0] already. */
+ char szModuleName[MAX_PATH];
+
+ GetModuleFileName(NULL, szModuleName, sizeof(szModuleName));
+ argv[0] = szModuleName;
+#endif
- if(!host.PerlCreate())
+ if (!host.PerlCreate())
exit(exitstatus);
exitstatus = host.PerlParse(xs_init, argc, argv, NULL);
@@ -74,6 +82,14 @@ __declspec(dllimport) int RunPerl(int argc, char **argv, char **env, void *ios);
int
main(int argc, char **argv, char **env)
{
+#ifndef __BORLANDC__
+ /* XXX this _may_ be a problem on some compilers (e.g. Borland) that
+ * want to free() argv after main() returns. As luck would have it,
+ * Borland's CRT does the right thing to argv[0] already. */
+ char szModuleName[MAX_PATH];
+ GetModuleFileName(NULL, szModuleName, sizeof(szModuleName));
+ argv[0] = szModuleName;
+#endif
return RunPerl(argc, argv, env, (void*)0);
}