This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make 4-arg win32_select() sleep more reasonably on false values
[perl5.git] / win32 / runperl.c
1
2 #ifdef PERL_OBJECT
3 #define USE_SOCKETS_AS_HANDLES
4 #include "EXTERN.h"
5 #include "perl.h"
6
7 #define NO_XSLOCKS
8 #include "XSUB.H"
9 #include "win32iop.h"
10
11 #include <fcntl.h>
12 #include "perlhost.h"
13
14
15 char *staticlinkmodules[] = {
16     "DynaLoader",
17     NULL,
18 };
19
20 EXTERN_C void boot_DynaLoader _((CV* cv _CPERLarg));
21
22 static void
23 xs_init(CPERLarg)
24 {
25     char *file = __FILE__;
26     dXSUB_SYS;
27     newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
28 }
29
30 CPerlObj *pPerl;
31
32 #undef PERL_SYS_INIT
33 #define PERL_SYS_INIT(a, c)
34
35 int
36 main(int argc, char **argv, char **env)
37 {
38     CPerlHost host;
39     int exitstatus = 1;
40
41     if(!host.PerlCreate())
42         exit(exitstatus);
43
44     exitstatus = host.PerlParse(xs_init, argc, argv, NULL);
45
46     if (!exitstatus)
47         exitstatus = host.PerlRun();
48
49     host.PerlDestroy();
50
51     return exitstatus;
52 }
53
54 #else  /* PERL_OBJECT */
55
56 #ifdef __GNUC__
57 /*
58  * GNU C does not do __declspec()
59  */
60 #define __declspec(foo) 
61
62 /* Mingw32 defaults to globing command line 
63  * This is inconsistent with other Win32 ports and 
64  * seems to cause trouble with passing -DXSVERSION=\"1.6\" 
65  * So we turn it off like this:
66  */
67 int _CRT_glob = 0;
68
69 #endif
70
71
72 __declspec(dllimport) int RunPerl(int argc, char **argv, char **env, void *ios);
73
74 int
75 main(int argc, char **argv, char **env)
76 {
77     return RunPerl(argc, argv, env, (void*)0);
78 }
79
80 #endif  /* PERL_OBJECT */