Hello!
Concerning the example
http://perldoc.perl.org/perlembed.html#Fiddling-with-the-Perl-stack-from-your-C-program.
If I copy the main() body, so that my main() looks like this:
int main (int argc, char **argv, char **env)
{
char *my_argv[] = { "", "power.pl" };
// ------------------- BEGIN original ------------------
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char **)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
PerlPower(3, 4); /*** Compute 3 ** 4 ***/
perl_destruct(my_perl);
perl_free(my_perl);
PERL_SYS_TERM();
// ------------------ END original ---------------
// ------------------ BEGIN copy ---------------
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char **)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
PerlPower(3, 4); /*** Compute 3 ** 4 ***/
perl_destruct(my_perl);
perl_free(my_perl);
PERL_SYS_TERM();
// ---------------- END copy --------------------
}
it doesn't work. Is this a bug, that PERL_SYS_TERM doesn't properly terminate
the perl engine, so that the consecutive PERL_SYS_INIT3 can't properly
initialize the perl again? Or I'm missing just another one macro?
I'd like to have two functions, that can properly initialize and deinitialize
the perl.
Thanks,
Andrey
P.S. Under GNU/Linux it works even without these macros. But I agree, it was
bad way.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs