diff options
Diffstat (limited to 'src/perl')
-rw-r--r-- | src/perl/perl-common.c | 3 | ||||
-rw-r--r-- | src/perl/perl-core.c | 17 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index d7a428e5..b641867f 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -246,10 +246,7 @@ char *perl_get_use_list(void) void irssi_callXS(void (*subaddr)(pTHX_ CV* cv), CV *cv, SV **mark) { - dSP; - PUSHMARK(mark); - PUTBACK; (*subaddr)(aTHX_ cv); } diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index 2f28c718..cb690906 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -82,16 +82,18 @@ static void perl_script_destroy(PERL_SCRIPT_REC *script) extern void boot_DynaLoader(pTHX_ CV* cv); #if PERL_STATIC_LIBS == 1 -extern void boot_Irssi(CV *cv); +extern void boot_Irssi(pTHX_ CV *cv); XS(boot_Irssi_Core) { dXSARGS; + PERL_UNUSED_VAR(items); irssi_callXS(boot_Irssi, cv, mark); irssi_boot(Irc); irssi_boot(UI); irssi_boot(TextUI); + /* Make sure to keep this in line with perl_scripts_deinit below. */ XSRETURN_YES; } #endif @@ -123,7 +125,7 @@ void perl_scripts_init(void) perl_parse(my_perl, xs_init, G_N_ELEMENTS(perl_args), perl_args, NULL); #if PERL_STATIC_LIBS == 1 - perl_eval_pv("Irssi::Core::boot_Irssi_Core();", TRUE); + perl_eval_pv("Irssi::Core::->boot_Irssi_Core(0.9);", TRUE); #endif perl_common_start(); @@ -155,6 +157,17 @@ void perl_scripts_deinit(void) /* Unload all perl libraries loaded with dynaloader */ perl_eval_pv("foreach my $lib (@DynaLoader::dl_modules) { if ($lib =~ /^Irssi\\b/) { $lib .= '::deinit();'; eval $lib; } }", TRUE); +#if PERL_STATIC_LIBS == 1 + /* If perl is statically built we should manually deinit the modules + which are booted in boot_Irssi_Core above */ + perl_eval_pv("foreach my $lib (qw(" + "Irssi" " " + "Irssi::Irc" " " + "Irssi::UI" " " + "Irssi::TextUI" + ")) { eval $lib . '::deinit();'; }", TRUE); +#endif + /* We could unload all libraries .. but this crashes with some libraries, probably because we don't call some deinit function.. Anyway, this would free some memory with /SCRIPT RESET, but it |