PERL_SET_INTERP causes an issue on newer versions of perl on windows because a symbol is not properly exported in their API, change the lines so it's basically what it used to be

This commit is contained in:
KimLS 2025-11-23 23:57:06 -08:00
parent e544f72da0
commit 42a3780d80

View File

@ -75,15 +75,15 @@ void Embperl::DoInit()
throw "Failed to init Perl (perl_alloc)"; throw "Failed to init Perl (perl_alloc)";
} }
PERL_SET_CONTEXT(my_perl); PERL_SET_CONTEXT(my_perl);
PERL_SET_INTERP(my_perl); PL_curinterp = (PerlInterpreter*)(my_perl);
PL_perl_destruct_level = 1; PL_perl_destruct_level = 1;
perl_construct(my_perl); perl_construct(my_perl);
perl_parse(my_perl, xs_init, argc, argv, nullptr); perl_parse(my_perl, xs_init, argc, argv, nullptr);
perl_run(my_perl); perl_run(my_perl);
//a little routine we use a lot. //a little routine we use a lot.
eval_pv("sub my_eval { eval $_[0];}", TRUE); //dies on error eval_pv("sub my_eval { eval $_[0];}", TRUE); //dies on error
//ruin the perl exit and command: //ruin the perl exit and command:
eval_pv("sub my_exit {}", TRUE); eval_pv("sub my_exit {}", TRUE);
eval_pv("sub my_sleep {}", TRUE); eval_pv("sub my_sleep {}", TRUE);
@ -95,7 +95,7 @@ void Embperl::DoInit()
GvCV_set(sleepgp, perl_get_cv("my_sleep", TRUE)); //dies on error GvCV_set(sleepgp, perl_get_cv("my_sleep", TRUE)); //dies on error
GvIMPORTED_CV_on(sleepgp); GvIMPORTED_CV_on(sleepgp);
} }
//declare our file eval routine. //declare our file eval routine.
try { try {
init_eval_file(); init_eval_file();
@ -181,7 +181,7 @@ Embperl::~Embperl()
void Embperl::Reinit() void Embperl::Reinit()
{ {
PERL_SET_CONTEXT(my_perl); PERL_SET_CONTEXT(my_perl);
PERL_SET_INTERP(my_perl); PL_curinterp = (PerlInterpreter*)(my_perl);
PL_perl_destruct_level = 1; PL_perl_destruct_level = 1;
perl_destruct(my_perl); perl_destruct(my_perl);
perl_free(my_perl); perl_free(my_perl);