2 #define WIN32_LEAN_AND_MEAN
11 * "The Road goes ever on and on, down from the door where it began."
23 # define EXTERN_C extern "C"
25 # define EXTERN_C extern
28 static void xs_init _((void));
30 __declspec(dllexport) int RunPerl(int argc, char **argv, char **env, void *iosubsystem)
33 PerlInterpreter *my_perl;
34 void *pOldIOSubsystem;
36 pOldIOSubsystem = SetIOSubSystem(iosubsystem);
38 PERL_SYS_INIT(&argc,&argv);
40 perl_init_i18nl10n(1);
42 if (!(my_perl = perl_alloc())) return (1);
43 perl_construct( my_perl );
44 perl_destruct_level = 0;
47 exitstatus = perl_parse( my_perl, xs_init, argc, argv, env);
49 exitstatus = perl_run( my_perl );
53 perl_destruct( my_perl );
58 SetIOSubSystem(pOldIOSubsystem);
63 /* Register any extra external extensions */
65 char *staticlinkmodules[]={
70 EXTERN_C void boot_DynaLoader _((CV* cv));
76 char *file = __FILE__;
77 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
80 extern HANDLE PerlDllHandle;
82 BOOL APIENTRY DllMain(HANDLE hModule, // DLL module handle
83 DWORD fdwReason, // reason called
84 LPVOID lpvReserved) // reserved
88 // The DLL is attaching to a process due to process
89 // initialization or a call to LoadLibrary.
90 case DLL_PROCESS_ATTACH:
91 //#define DEFAULT_BINMODE
92 #ifdef DEFAULT_BINMODE
93 _setmode( _fileno( stdin ), _O_BINARY );
94 _setmode( _fileno( stdout ), _O_BINARY );
95 _setmode( _fileno( stderr ), _O_BINARY );
99 PerlDllHandle = hModule;
102 // The DLL is detaching from a process due to
103 // process termination or call to FreeLibrary.
104 case DLL_PROCESS_DETACH:
107 // The attached process creates a new thread.
108 case DLL_THREAD_ATTACH:
111 // The thread of the attached process terminates.
112 case DLL_THREAD_DETACH: