如果您選擇Perl,有足夠的資源來連接其他語言。
Inline::C
Inline::CPP
Inline::Java
從Inline::C-Cookbook:
use Inline C => <<'END_C';
void greet() {
printf("Hello, world\n");
}
END_C
greet;
用Perl 6它變得更容易使用NativeCall從機庫代碼導入子程序。
use v6.c;
sub c-print (Str() $s){
use NativeCall;
# restrict the function to inside of this subroutine because printf is
# vararg based, and we only handle '%s' based inputs here
# it should be possible to handle more but it requires generating
# a Signature object based on the format string and then do a
# nativecast with that Signature, and a pointer to printf
sub printf (str, str --> int32) is native('libc:6') {}
printf '%s', $s
}
c-print 'Hello World';
這只是一個簡單的例子,你可以創建一個具有指針的表示一類,並且有一定的方法是將要使用的庫的C代碼。 (僅當C代碼的第一個參數是指針時才起作用,否則您將不得不將其包裝)
如果您需要Perl 6子例程/方法名稱不同,可以使用is symbol
特性修改器。
也有用於Perl 6的內聯模塊。
幾年前,Ovid告訴我,AI :: PRolog對於生產用途來說太慢了。我本來想用它來做一個項目,他讓我氣餒:) – 2008-11-07 21:07:17