2 * "The Road goes ever on and on, down from the door where it began."
15 # define EXTERN_C extern "C"
17 # define EXTERN_C extern
20 static void xs_init _((void));
22 __declspec(dllexport) int
23 RunPerl(int argc, char **argv, char **env, void *iosubsystem)
26 PerlInterpreter *my_perl;
27 void *pOldIOSubsystem;
29 pOldIOSubsystem = SetIOSubSystem(iosubsystem);
31 PERL_SYS_INIT(&argc,&argv);
33 perl_init_i18nl10n(1);
35 if (!(my_perl = perl_alloc()))
37 perl_construct( my_perl );
38 perl_destruct_level = 0;
40 exitstatus = perl_parse( my_perl, xs_init, argc, argv, env);
42 exitstatus = perl_run( my_perl );
45 perl_destruct( my_perl );
50 SetIOSubSystem(pOldIOSubsystem);
55 extern HANDLE PerlDllHandle;
58 DllMain(HANDLE hModule, /* DLL module handle */
59 DWORD fdwReason, /* reason called */
60 LPVOID lpvReserved) /* reserved */
63 /* The DLL is attaching to a process due to process
64 * initialization or a call to LoadLibrary.
66 case DLL_PROCESS_ATTACH:
67 /* #define DEFAULT_BINMODE */
68 #ifdef DEFAULT_BINMODE
69 setmode( fileno( stdin ), O_BINARY );
70 setmode( fileno( stdout ), O_BINARY );
71 setmode( fileno( stderr ), O_BINARY );
74 PerlDllHandle = hModule;
77 /* The DLL is detaching from a process due to
78 * process termination or call to FreeLibrary.
80 case DLL_PROCESS_DETACH:
83 /* The attached process creates a new thread. */
84 case DLL_THREAD_ATTACH:
87 /* The thread of the attached process terminates. */
88 case DLL_THREAD_DETACH:
97 /* Register any extra external extensions */
99 char *staticlinkmodules[] = {
104 EXTERN_C void boot_DynaLoader _((CV* cv));
109 char *file = __FILE__;
111 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);