From ebe6bf830504347a7e4a00cd3724c469d20dc1c9 Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Wed, 27 Jul 2016 10:35:03 +0200 Subject: [PATCH] C: simplify boot_DynaLoader, fix windows dll slashes from cperl-5.24.0 --- lib/B/C.pm | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/B/C.pm b/lib/B/C.pm index e6fb34b00..0d8363678 100644 --- a/lib/B/C.pm +++ b/lib/B/C.pm @@ -7122,7 +7122,7 @@ static void xs_init(pTHX) { char *file = __FILE__; - dTARG; dSP; + dTARG; dSP; CV * cv; _EOT8 if ($CPERL51 and $debug{cv}) { print q{ @@ -7134,9 +7134,6 @@ _EOT8 #if ($staticxs) { #FIXME! # print "\n#undef USE_DYNAMIC_LOADING #} - print "\n#ifdef USE_DYNAMIC_LOADING"; - print "\n\tnewXS(\"DynaLoader::boot_DynaLoader\", boot_DynaLoader, file);"; - print "\n#endif\n"; delete $xsub{'DynaLoader'}; delete $xsub{'UNIVERSAL'}; @@ -7156,11 +7153,8 @@ _EOT8 printf "\tXPUSHp(\"DynaLoader\", %d);\n", length("DynaLoader"); print "\tPUTBACK;\n"; warn "bootstrapping DynaLoader added to xs_init\n" if $verbose; - if ($PERL522) { - print "\tboot_DynaLoader(aTHX_ get_cv(\"DynaLoader::bootstrap\", GV_ADD));\n"; - } else { - print "\tboot_DynaLoader(aTHX_ NULL);\n"; - } + print "\tcv = newXS(\"DynaLoader::boot_DynaLoader\", boot_DynaLoader, file);\n"; + print "\tboot_DynaLoader(aTHX_ cv);\n"; print "\tSPAGAIN;\n"; if ($CPERL51 and $^O ne 'MSWin32') { print "\tdl_boot(aTHX);\n"; @@ -7350,10 +7344,11 @@ _EOT9 $sofile = "$modlibname/auto/$modpname/$modfname.".$Config{dlext}; } #warn "load_file: $stashname, $stashfile, $sofile"; - printf "\tmXPUSHp(\"%s\", %d);\n", $sofile, length($sofile); - } else { - printf "\tmXPUSHp(\"%s\", %d);\n", $stashfile, length($stashfile); + $stashfile = $sofile; } + my $stashfile_len = length($stashfile); + $stashfile =~ s/(\\[^nrftacx"' ])/\\$1/g; # windows paths: \\ => \\\\ + printf "\tmXPUSHp(\"%s\", %d);\n", $stashfile, $stashfile_len; } print "\tPUTBACK;\n"; warn "bootstrapping $stashname added to XSLoader dl_init\n" if $verbose;