perl6 – Perl 6 NativeCall和C源文件

前端之家收集整理的这篇文章主要介绍了perl6 – Perl 6 NativeCall和C源文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
使用NativeCall为 WindowsLinux发布用于C库的Perl 6绑定的最佳策略是什么?

开发人员是否需要编译.dll和.so文件并将它们与perl6代码一起上传到github?或者perl6上有一个选项,比如perl5可以将C源文件与Perl 6代码捆绑在一起,C编译器将作为make和make install的一部分运行吗?

解决方法

不需要首先编译库(尽管它们可能是).要完成此任务,首先需要在发行版的根目录中使用Build.pm文件

class Builder {
    method build($dist-path) {
        # do build stuff to your module
        # which is located at $dist-path
    }

    # Only needed for panda compatability
    method isa($what) {
        return True if $what.^name eq 'Panda::Builder';
        callsame;
    }
}

然后你会想要使用像LibraryMake这样的模块.这里我们在构建方法中使用它的make例程:

use LibraryMake;

class Builder {
    method build($dist-path) {
        make($dist-path,"$dist-path/resources");

        # or you could do the appropriate `shell` calls
        # yourself and have no extra dependencies
    }

    ...

包管理器zefpanda支持方法,并且还允许通过perl6 -I手动运行它. -MBuild -e’Builder.new.build($* CWD)’

Here是一个工作的例子

猜你在找的Perl相关文章