PerlFFI/FFI-CheckLib

Can't find Windows libraries with .DLL extension in upper case

Ilya33 opened this issue · 5 comments

Hello.

The find_lib function can't find Windows libraries with .DLL extension in upper case.
For example I have Windows7 with COLORCNV.DLL and IPHLPAPI.DLL in C:\Windows\System32.

Code example:

my ($lib) = find_lib(
    lib => 'IPHLPAPI',
    # lib => 'IPHLPAPI.DLL'
)
# $lib is undef

if replace line 91 in FFI/CheckLib.pm

# from
$pattern = [ qr{^(?:lib)?(.*?)(?:-([0-9])+)?\.dll$} ];
# to
$pattern = [ qr{^(?:lib)?(.*?)(?:-([0-9])+)?\.(?i)dll$} ];

it resolve the problem.

Maybe exists a better solution

No I think your solution is right. Can you provide a PR with a test?

Actually I think we'd better make the entire regex case insensitive.

FFI-CheckLib-0.21_01.tar.gz should address this. I will make a production release soon if it looks good on cpantesters.

Thank you very much!

fyi- Released this just now as 0.22, which is a production version.