in reply to Re: Win32/MingW SetupAPI usage woes with Inline::C
in thread Win32/MingW SetupAPI usage woes with Inline::C

Thanks. Sorry I didn't see this sooner.

I tried that first. So, after reading your note I searched the entire C: drive (where MinGW is installed).

I found another libsetupapi.a in C:\Perl-5.22.1-64\site\lib\auto\MinGW\x86_64-w64-mingw32\lib

And specifying that does compile. Apparently Inline::C installs it there. But hardcoding a path makes this very unportable to another system.

So, the new question is: how do I get that path portably?

I can use Config; $Config{sitelibexp} for part of the way: 'C:\Perl-5.22.1-64\site\lib' (which also appears in @INC)

But this is magic: "\auto\MinGW\x86_64-w64-mingw32\lib" There some pkg-config -like method for Perl...

For now, I use this expensive hack

use File::Find; my $libpath; my $incpath; BEGIN { find( { wanted => sub { /^libsetupapi\.a$/i && ($libpath ||= $File::Find::dir); /^setupapi\.h$/i && ($incpath ||= $File::Find::dir); }, follow => 1, follow_skip => 2 }, @INC ); die( "No MinGW libsetupapi $libpath $incpath\n" ) unless( $libpath && $incpath ); } use Inline( C => Config => libs => "-L$libpath -lSetupAPI", INC => "-I$incpath", );

There must be a better way. Meantime, on to figuring out the mysteries of the Windoze APIs.