Skip to content

Commit 2c61b35

Browse files
committed
Win32 Liblist test for system library, fix so finds
1 parent 6078d1e commit 2c61b35

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/ExtUtils/Liblist/Kid.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ sub _win32_default_search_paths {
379379

380380
push @libpath, split /;/, $ENV{LIB} if $VC and $ENV{LIB};
381381
push @libpath, split /;/, $ENV{LIBRARY_PATH} if $GC and $ENV{LIBRARY_PATH};
382+
push @libpath, "$ENV{SYSTEMROOT}\\system32" if $ENV{SYSTEMROOT};
382383

383384
return @libpath;
384385
}
@@ -435,8 +436,8 @@ sub _win32_try_attach_extension {
435436
}
436437

437438
sub _win32_lib_extensions {
438-
my @extensions;
439-
push @extensions, $Config{'lib_ext'} if $Config{'lib_ext'};
439+
my @extensions = grep $_, @Config{qw(lib_ext)};
440+
push @extensions, map ".$_", grep $_, @Config{qw(dlext so)};
440441
push @extensions, '.dll.a' if grep { m!^\.a$! } @extensions;
441442
push @extensions, '.lib' unless grep { m!^\.lib$! } @extensions;
442443
return \@extensions;

t/Liblist_Kid.t

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use strict;
22
use warnings;
3+
use lib 't/lib';
34
use Test::More 'no_plan';
45
use ExtUtils::MakeMaker::Config;
56
use File::Spec;
67
use Cwd;
78
use File::Temp qw[tempdir];
89

9-
use lib 't/lib';
1010
use MakeMaker::Test::Utils;
1111

1212
# Liblist wants to be an object which has File::Spec capabilities, so we
@@ -141,6 +141,8 @@ sub test_kid_unix_os2 {
141141
sub test_kid_win32 {
142142
my $warnings = "";
143143
local $SIG{__WARN__} = sub { $warnings .= "@_\n"; };
144+
my @got32 = _ext( 'kernel32' );
145+
like $got32[0], qr/kernel32/, 'found Win32 system library' or diag 'got: ', explain \@got32;
144146
is_deeply( [ _ext( 'test' ) ], [ double(quote('test.lib'), '') ], 'existent file results in a path to the file. .lib is default extension with empty %Config' );
145147
is_deeply( [ _ext( 'c_test' ) ], [ double(quote('lib\CORE\c_test.lib'), '') ], '$Config{installarchlib}/CORE is the default search dir aside from cwd' );
146148
is_deeply( [ _ext( 'double' ) ], [ double(quote('double.lib'), '') ], 'once an instance of a lib is found, the search stops' );

0 commit comments

Comments
 (0)