Permalink
Browse files

[lib/NativeCall.pm6] add patch provided by pmichaud++

Although there are still some errors in parameter or return value passing
between Rakudo/Zavolaj and Parrot, this patch fixes quite a few of them, most
notably those using the Str data type.  The patch was posted at
https://gist.github.com/976023
  • Loading branch information...
1 parent ac6ec7c commit d907f71c3d2953e285666edad5643514cb443ee0 @mberends mberends committed Jun 2, 2011
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/NativeCall.pm6
  2. 0 t/{load.t → 01-load.t}
View
13 lib/NativeCall.pm6
@@ -22,9 +22,9 @@ class NativeArray {
my $fpa = pir::new__Ps('ResizableIntegerArray');
my $typeid;
given $!of {
- when Str { $typeid = -70 }
- when Int { $typeid = -92 }
- when Num { $typeid = -83 }
+ when Str { $typeid = 30 }
+ when Int { $typeid = 7 }
+ when Num { $typeid = 16 }
default { die "Unknown type"; }
}
Q:PIR {
@@ -89,6 +89,11 @@ our sub make-mapper(Mu $type) {
}
}
+our $ncifunc = Q:PIR {
+ load_bytecode 'NCI/Utils.pbc'
+ %r = get_root_global ['parrot';'NCI';'Utils'], 'ncifunc'
+};
+
our multi trait_mod:<is>(Routine $r, $libname?, :$native!) {
my $entry-point = $r.name();
my $call-sig = perl6-sig-to-backend-sig($r);
@@ -103,7 +108,7 @@ our multi trait_mod:<is>(Routine $r, $libname?, :$native!) {
}
pir::setattribute__vPsP($r, '$!do', -> |$c {
$return-mapper(
- pir::descalarref__PP( (pir::dlfunc__PPss(
+ pir::descalarref__PP( ($ncifunc(
($lib ?? pir::descalarref__PP($lib) !! pir::null__P()),
$entry-point,
$call-sig
View
0 t/load.t → t/01-load.t
File renamed without changes.

0 comments on commit d907f71

Please sign in to comment.