#include #include #include #include #include #include #define EXPORT __declspec(dllexport) PerlInterpreter *my_perl; BOOL WINAPI DllMain( HINSTANCE hinstDLL, // handle to DLL module DWORD fdwReason, // reason for calling function LPVOID lpReserved ) // reserved { switch( fdwReason ) { case DLL_PROCESS_ATTACH: { //Perlskript parsen char *embedding[] = { "", "C:\\script.pl", "0" }; my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, NULL, 3, embedding, NULL); PL_exit_flags |= PERL_EXIT_DESTRUCT_END; break; } case DLL_THREAD_ATTACH: { // Do thread-specific initialization. break; } case DLL_THREAD_DETACH: { // Do thread-specific cleanup. break; } case DLL_PROCESS_DETACH: { perl_free(my_perl); PERL_SYS_TERM(); break; } } return TRUE; // Successful DLL_PROCESS_ATTACH. } EXPORT int test() { char *args[] = { NULL }; call_argv("perlfunction", G_DISCARD | G_NOARGS, args); return 0; }