summaryrefslogtreecommitdiff
path: root/win32/runperl.c
blob: 3947f9ef377299c322f34302611eec034dcfddd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

#ifdef PERL_OBJECT
#define USE_SOCKETS_AS_HANDLES
#include "EXTERN.h"
#include "perl.h"

#define NO_XSLOCKS
#include "XSUB.H"
#include "win32iop.h"

#include <fcntl.h>
#include "perlhost.h"


char *staticlinkmodules[] = {
    "DynaLoader",
    NULL,
};

EXTERN_C void boot_DynaLoader _((CV* cv _CPERLarg));

static void
xs_init(CPERLarg)
{
    char *file = __FILE__;
    dXSUB_SYS;
    newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
}

CPerlObj *pPerl;

#undef PERL_SYS_INIT
#define PERL_SYS_INIT(a, c)

int
main(int argc, char **argv, char **env)
{
    CPerlHost host;
    int exitstatus = 1;

    if(!host.PerlCreate())
	exit(exitstatus);

    exitstatus = host.PerlParse(xs_init, argc, argv, NULL);

    if (!exitstatus)
	exitstatus = host.PerlRun();

    host.PerlDestroy();

    return exitstatus;
}

#else  /* PERL_OBJECT */

#ifdef __GNUC__
/*
 * GNU C does not do __declspec()
 */
#define __declspec(foo) 

/* Mingw32 defaults to globing command line 
 * This is inconsistent with other Win32 ports and 
 * seems to cause trouble with passing -DXSVERSION=\"1.6\" 
 * So we turn it off like this:
 */
int _CRT_glob = 0;

#endif


__declspec(dllimport) int RunPerl(int argc, char **argv, char **env, void *ios);

int
main(int argc, char **argv, char **env)
{
    return RunPerl(argc, argv, env, (void*)0);
}

#endif  /* PERL_OBJECT */