File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -659,18 +659,27 @@ to callbacks.
659
659
660
660
= head1 Library Paths and Names
661
661
662
- = comment TODO
663
-
664
- TBD more
665
-
666
- The C < native > trait accepts the library name or the full path .
662
+ The C < native > trait accepts the library name, the full path, or a subroutine
663
+ returning either of the two. When using the library name, the name is assumed
664
+ to be prepended with "lib" and appended with ".so" (or just appended with
665
+ ".dll" on Windows), and will be searched for in the paths in the
666
+ LD_LIBRARY_PATH (PATH on Windows) environment variable .
667
667
668
+ = begin code :skip-test
668
669
use NativeCall;
669
670
constant LIBMYSQL = 'mysqlclient';
670
671
constant LIBFOO = '/usr/lib/libfoo.so.1';
672
+ sub LIBBAR {
673
+ my $path = qx/pkg-config --libs libbar/.chomp;
674
+ $path ~~ s/\/[[\w+]+ % \/]/\0\/bar/;
675
+ $path
676
+ }
671
677
# and later
678
+
672
679
sub mysql_affected_rows returns int32 is native(LIBMYSQL) {*};
673
680
sub bar is native(LIBFOO) {*}
681
+ sub baz is native(LIBBAR) {*}
682
+ = end code
674
683
675
684
You can also put an incomplete path like './foo' and NativeCall will automatically put
676
685
the right extension according to the platform specification.
You can’t perform that action at this time.
0 commit comments