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));
67 char *file = __FILE__;
68 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
71 extern HANDLE PerlDllHandle;
74 DllMain(HANDLE hModule, /* DLL module handle */
75 DWORD fdwReason, /* reason called */
76 LPVOID lpvReserved) /* reserved */
79 /* The DLL is attaching to a process due to process
80 * initialization or a call to LoadLibrary.
82 case DLL_PROCESS_ATTACH:
83 /* #define DEFAULT_BINMODE */
84 #ifdef DEFAULT_BINMODE
85 _setmode( _fileno( stdin ), _O_BINARY );
86 _setmode( _fileno( stdout ), _O_BINARY );
87 _setmode( _fileno( stderr ), _O_BINARY );
90 PerlDllHandle = hModule;
93 /* The DLL is detaching from a process due to
94 * process termination or call to FreeLibrary.
96 case DLL_PROCESS_DETACH:
99 /* The attached process creates a new thread. */
100 case DLL_THREAD_ATTACH:
103 /* The thread of the attached process terminates. */
104 case DLL_THREAD_DETACH: