#include #include #include static void xs_init (pTHX); EXTERN_C void xs_init (pTHX); EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); EXTERN_C void boot_Win32CORE (pTHX_ CV* cv); EXTERN_C void xs_init(pTHX) { char *file = __FILE__; dXSUB_SYS; /* DynaLoader is a special case */ newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); newXS("Win32CORE::bootstrap", boot_Win32CORE, file); } #define BUFFER_SIZE 1024 static PerlInterpreter *my_perl = NULL; STRLEN n_a; int main() { char plfile [BUFFER_SIZE]; char *embedding [] = { "", plfile }; int exitstatus = 0; int stripchars = 1; while(printf("Enter file name: ") && fgets(plfile, BUFFER_SIZE, stdin)) { plfile[strlen(plfile) - stripchars] = '\0'; /* strip \n */ if ((my_perl = perl_alloc()) == NULL) { fprintf (stderr, "no memory!"); exit (1); } PL_perl_destruct_level = 2; perl_construct (my_perl); exitstatus = perl_parse (my_perl, xs_init, 2, embedding, NULL); if (!exitstatus) { exitstatus = perl_run (my_perl); } PL_perl_destruct_level = 2; perl_destruct (my_perl); PL_perl_destruct_level = 2; perl_free (my_perl); stripchars = 2; } exit (exitstatus); }