2 * "The Road goes ever on and on, down from the door where it began."
14 # define EXTERN_C extern "C"
16 # define EXTERN_C extern
19 static void xs_init _((void));
21 __declspec(dllexport) int
22 RunPerl(int argc, char **argv, char **env, void *iosubsystem)
25 PerlInterpreter *my_perl;
26 void *pOldIOSubsystem;
28 pOldIOSubsystem = SetIOSubSystem(iosubsystem);
30 PERL_SYS_INIT(&argc,&argv);
32 perl_init_i18nl10n(1);
34 if (!(my_perl = perl_alloc()))
36 perl_construct( my_perl );
37 perl_destruct_level = 0;
39 exitstatus = perl_parse( my_perl, xs_init, argc, argv, env);
41 exitstatus = perl_run( my_perl );
44 perl_destruct( my_perl );
49 SetIOSubSystem(pOldIOSubsystem);
54 /* Register any extra external extensions */
56 char *staticlinkmodules[] = {
61 EXTERN_C void boot_DynaLoader _((CV* cv));
66 char *file = __FILE__;
69 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
72 extern HANDLE PerlDllHandle;
75 DllMain(HANDLE hModule, /* DLL module handle */
76 DWORD fdwReason, /* reason called */
77 LPVOID lpvReserved) /* reserved */
80 /* The DLL is attaching to a process due to process
81 * initialization or a call to LoadLibrary.
83 case DLL_PROCESS_ATTACH:
84 /* #define DEFAULT_BINMODE */
85 #ifdef DEFAULT_BINMODE
86 _setmode( _fileno( stdin ), _O_BINARY );
87 _setmode( _fileno( stdout ), _O_BINARY );
88 _setmode( _fileno( stderr ), _O_BINARY );
91 PerlDllHandle = hModule;
94 /* The DLL is detaching from a process due to
95 * process termination or call to FreeLibrary.
97 case DLL_PROCESS_DETACH:
100 /* The attached process creates a new thread. */
101 case DLL_THREAD_ATTACH:
104 /* The thread of the attached process terminates. */
105 case DLL_THREAD_DETACH: