Commit | Line | Data |
76e3520e |
1 | #include "EXTERN.h" |
2 | #include "perl.h" |
3 | |
80252599 |
4 | #ifdef PERL_OBJECT |
5 | |
565764a8 |
6 | #define NO_XSLOCKS |
76e3520e |
7 | #include "XSUB.H" |
0f4eea8f |
8 | #include "win32iop.h" |
c69f6586 |
9 | |
10 | #include <fcntl.h> |
0f4eea8f |
11 | #include "perlhost.h" |
c69f6586 |
12 | |
c69f6586 |
13 | |
0f4eea8f |
14 | char *staticlinkmodules[] = { |
15 | "DynaLoader", |
16 | NULL, |
c69f6586 |
17 | }; |
76e3520e |
18 | |
20ce7b12 |
19 | EXTERN_C void boot_DynaLoader (CV* cv _CPERLarg); |
76e3520e |
20 | |
0f4eea8f |
21 | static void |
22 | xs_init(CPERLarg) |
76e3520e |
23 | { |
0f4eea8f |
24 | char *file = __FILE__; |
25 | dXSUB_SYS; |
26 | newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); |
27 | } |
76e3520e |
28 | |
0f4eea8f |
29 | CPerlObj *pPerl; |
76e3520e |
30 | |
76e3520e |
31 | int |
32 | main(int argc, char **argv, char **env) |
33 | { |
c69f6586 |
34 | CPerlHost host; |
35 | int exitstatus = 1; |
80252599 |
36 | #ifndef __BORLANDC__ |
37 | /* XXX this _may_ be a problem on some compilers (e.g. Borland) that |
38 | * want to free() argv after main() returns. As luck would have it, |
39 | * Borland's CRT does the right thing to argv[0] already. */ |
40 | char szModuleName[MAX_PATH]; |
b5ce6607 |
41 | char *ptr; |
80252599 |
42 | |
43 | GetModuleFileName(NULL, szModuleName, sizeof(szModuleName)); |
8ac9c18d |
44 | (void)win32_longpath(szModuleName); |
80252599 |
45 | argv[0] = szModuleName; |
46 | #endif |
76e3520e |
47 | |
a6c40364 |
48 | PERL_SYS_INIT(&argc,&argv); |
49 | |
80252599 |
50 | if (!host.PerlCreate()) |
c69f6586 |
51 | exit(exitstatus); |
76e3520e |
52 | |
0f4eea8f |
53 | exitstatus = host.PerlParse(xs_init, argc, argv, NULL); |
76e3520e |
54 | |
c69f6586 |
55 | if (!exitstatus) |
c69f6586 |
56 | exitstatus = host.PerlRun(); |
76e3520e |
57 | |
c69f6586 |
58 | host.PerlDestroy(); |
76e3520e |
59 | |
60 | return exitstatus; |
61 | } |
62 | |
76e3520e |
63 | #else /* PERL_OBJECT */ |
64 | |
a835ef8a |
65 | #ifdef __GNUC__ |
5b0d9cbe |
66 | /* |
67 | * GNU C does not do __declspec() |
68 | */ |
a835ef8a |
69 | #define __declspec(foo) |
5b0d9cbe |
70 | |
71 | /* Mingw32 defaults to globing command line |
72 | * This is inconsistent with other Win32 ports and |
73 | * seems to cause trouble with passing -DXSVERSION=\"1.6\" |
74 | * So we turn it off like this: |
75 | */ |
76 | int _CRT_glob = 0; |
77 | |
a835ef8a |
78 | #endif |
0a753a76 |
79 | |
5b0d9cbe |
80 | |
390b85e7 |
81 | __declspec(dllimport) int RunPerl(int argc, char **argv, char **env, void *ios); |
0a753a76 |
82 | |
137443ea |
83 | int |
0a753a76 |
84 | main(int argc, char **argv, char **env) |
85 | { |
80252599 |
86 | #ifndef __BORLANDC__ |
87 | /* XXX this _may_ be a problem on some compilers (e.g. Borland) that |
88 | * want to free() argv after main() returns. As luck would have it, |
89 | * Borland's CRT does the right thing to argv[0] already. */ |
90 | char szModuleName[MAX_PATH]; |
b5ce6607 |
91 | char *ptr; |
92 | |
80252599 |
93 | GetModuleFileName(NULL, szModuleName, sizeof(szModuleName)); |
8ac9c18d |
94 | (void)win32_longpath(szModuleName); |
80252599 |
95 | argv[0] = szModuleName; |
96 | #endif |
390b85e7 |
97 | return RunPerl(argc, argv, env, (void*)0); |
0a753a76 |
98 | } |
76e3520e |
99 | |
100 | #endif /* PERL_OBJECT */ |