perl namespacing, since we can bless now

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-11-24 11:13:55 +01:00
parent 913a8a72ce
commit 3348e1b840

View File

@ -24,7 +24,16 @@ use DynaLoader ();
my $LIB;
sub __load_shared_lib {
BEGIN {
my sub newXS {
my ($perl_func_name, $full_symbol_name, $filename) = @_;
my $sym = DynaLoader::dl_find_symbol($LIB, $full_symbol_name);
die "failed to locate '$full_symbol_name'\n" if !defined $sym;
DynaLoader::dl_install_xsub($perl_func_name, $sym, $filename);
}
my sub __load_shared_lib {
return if $LIB;
my ($pkg) = @_;
@ -38,17 +47,8 @@ sub __load_shared_lib {
$LIB = DynaLoader::dl_load_file($mod_files[0])
or die "failed to load library '$mod_files[0]'\n";
}
}
sub newXS {
my ($perl_func_name, $full_symbol_name, $filename) = @_;
my $sym = DynaLoader::dl_find_symbol($LIB, $full_symbol_name);
die "failed to locate '$full_symbol_name'\n" if !defined $sym;
DynaLoader::dl_install_xsub($perl_func_name, $sym, $filename);
}
BEGIN {
__load_shared_lib(__PACKAGE__);
"#;