#include #include #include #include int main() { int exitstatus; std::vector argv; argv.push_back("perl"); argv.push_back("C:\perl\bin\foo.pl"); PerlInterpreter* my_perl; my_perl = perl_alloc(); if (my_perl == NULL) { std::cout << "Error with perl_alloc" << std::endl; return 1; } perl_construct(my_perl); ///// This call crashes with an access violation ///// exitstatus = perl_parse(my_perl, NULL, 2, &argv[0], NULL); if (exitstatus) { std::cout << "Error with perl_parse" << std::endl; return 1; } exitstatus = perl_run(my_perl); if (exitstatus) { std::cout << "Error with perl_run" << std::endl; return 1; } perl_destruct( my_perl ); perl_free( my_perl ); return 0; } #### int main() { PERL_SYS_INIT(0, NULL); int exitstatus; std::vector argv; argv.push_back("perl"); argv.push_back("C:\\perl\\bin\\foo.pl"); PerlInterpreter* my_perl; my_perl = perl_alloc(); if (my_perl == NULL) { std::cout << "Error with perl_alloc" << std::endl; return 1; } perl_construct(my_perl); exitstatus = perl_parse(my_perl, NULL, 2, &argv[0], NULL); if (exitstatus) { std::cout << "Error with perl_parse" << std::endl; return 1; } exitstatus = perl_run(my_perl); if (exitstatus) { std::cout << "Error with perl_run" << std::endl; return 1; } perl_destruct(my_perl); perl_free(my_perl); PERL_SYS_TERM(); return 0; }