2 * "The Road goes ever on and on, down from the door where it began."
11 # define EXTERN_C extern "C"
13 # define EXTERN_C extern
16 static void xs_init _((void));
18 __declspec(dllexport) int
19 RunPerl(int argc, char **argv, char **env, void *iosubsystem)
22 PerlInterpreter *my_perl;
23 void *pOldIOSubsystem;
25 pOldIOSubsystem = SetIOSubSystem(iosubsystem);
27 PERL_SYS_INIT(&argc,&argv);
29 perl_init_i18nl10n(1);
31 if (!(my_perl = perl_alloc()))
33 perl_construct( my_perl );
34 perl_destruct_level = 0;
36 exitstatus = perl_parse( my_perl, xs_init, argc, argv, env);
38 exitstatus = perl_run( my_perl );
41 perl_destruct( my_perl );
46 SetIOSubSystem(pOldIOSubsystem);
51 extern HANDLE PerlDllHandle;
54 DllMain(HANDLE hModule, /* DLL module handle */
55 DWORD fdwReason, /* reason called */
56 LPVOID lpvReserved) /* reserved */
59 /* The DLL is attaching to a process due to process
60 * initialization or a call to LoadLibrary.
62 case DLL_PROCESS_ATTACH:
63 /* #define DEFAULT_BINMODE */
64 #ifdef DEFAULT_BINMODE
65 setmode( fileno( stdin ), O_BINARY );
66 setmode( fileno( stdout ), O_BINARY );
67 setmode( fileno( stderr ), O_BINARY );
70 PerlDllHandle = hModule;
73 /* The DLL is detaching from a process due to
74 * process termination or call to FreeLibrary.
76 case DLL_PROCESS_DETACH:
79 /* The attached process creates a new thread. */
80 case DLL_THREAD_ATTACH:
83 /* The thread of the attached process terminates. */
84 case DLL_THREAD_DETACH:
93 /* Register any extra external extensions */
95 char *staticlinkmodules[] = {
100 EXTERN_C void boot_DynaLoader _((CV* cv));
105 char *file = __FILE__;
107 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);