-
-
Save zengargoyle/a46a59f140d3c90b2cb7 to your computer and use it in GitHub Desktop.
library searching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use LibraryMake; | |
use LibraryCheck; | |
sub find-library( Str:D $library, :$version ) { | |
my $so = get-vars('')<SO>; | |
return $library if $so eq '.dll'; # Windows? | |
return $library ~ $so if library-exists( $library ~ $so ); | |
if $version.defined { | |
return $library ~ $so ~ ".$version" | |
if library-exists( $library ~ $so ~ ".$version"); | |
} | |
fail "Could not find library for $library"; | |
} | |
sub library { find-library('libfoo', '1') } | |
# ... is native(&library) ... | |
# | |
sub MAIN('test', $library, $version = Str) { | |
say find-library($library, :$version); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment