sub have_functions { my @funcs = (); print "detecting available functions... "; my @paths = DynaLoader::dl_findfile(split /\s+/, $options{LIBS}); die "Couldn't find any library file satisfying '$options{LIBS}'" unless @paths; my $libfile = $paths[0]; # On Win32, we assume that the lib file will not be statically linked # but will be a thin wrapper for a similarly named .dll file. # This is not universal but works in many cases # This assumes that a library -l$foo will map to lib$foo.a # through DynaLoader. We then try to find and load $foo.dll in $ENV{PATH} if ($has_Win32) { (my $dll = basename $libfile) =~ s/\.\w+$//; $dll =~ s/^lib//; $dll .= '.dll'; ($libfile) = grep { -f } map { File::Spec->catfile($_,$dll) } File::Spec->path; die "'$dll' not found in PATH" unless $libfile; }; warn "Using '$libfile' as potential symbol candidate"; my $libref = DynaLoader::dl_load_file($libfile); warn "Couldn't load $libfile via DynaLoader ($^E)" unless $libref; for my $func (@_) { my $symref = DynaLoader::dl_find_symbol($libref, $func); push @funcs, $func if defined $symref; #print "$func", $symref ? "" : " NOT", " found\n"; }; print "ok\n"; return @funcs }