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 @@ -646,18 +646,27 @@ to callbacks.
646
646
647
647
= head1 Library Paths and Names
648
648
649
- = comment TODO
650
-
651
- TBD more
652
-
653
- The C < native > trait accepts the library name or the full path .
649
+ The C < native > trait accepts the library name, the full path, or a subroutine
650
+ returning either of the two. When using the library name, the name is assumed
651
+ to be prepended with "lib" and appended with ".so" (or just appended with
652
+ ".dll" on Windows), and will be searched for in the paths in the
653
+ LD_LIBRARY_PATH (PATH on Windows) environment variable .
654
654
655
+ = begin code :skip-test
655
656
use NativeCall;
656
657
constant LIBMYSQL = 'mysqlclient';
657
658
constant LIBFOO = '/usr/lib/libfoo.so.1';
659
+ sub LIBBAR {
660
+ my $path = qx/pkg-config --libs libbar/.chomp;
661
+ $path ~~ s/\/[[\w+]+ % \/]/\0\/bar/;
662
+ $path
663
+ }
658
664
# and later
665
+
659
666
sub mysql_affected_rows returns int32 is native(LIBMYSQL) {*};
660
667
sub bar is native(LIBFOO) {*}
668
+ sub baz is native(LIBBAR) {*}
669
+ = end code
661
670
662
671
You can also put an incomplete path like './foo' and NativeCall will automatically put
663
672
the right extension according to the platform specification.
You can’t perform that action at this time.
0 commit comments