File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -653,9 +653,18 @@ say $esponja;
653
653
654
654
NativeCall also supports native functions that take functions as arguments. One
655
655
example of this is using function pointers as callbacks in an event-driven
656
- system. When binding these functions via NativeCall, one need only provide the
656
+ system. When binding these functions via NativeCall, one should need only provide the
657
657
equivalent signature as L < a constraint on the code parameter|/type/Signature#Constraining_signatures_of_Callables > :
658
658
659
+ # See below--this syntax does not work on Rakudo currently
660
+ use NativeCall;
661
+ # void SetCallback(int (*callback)(const char *))
662
+ my sub SetCallback(&callback:(Str --> int32)) is native('mylib') { * }
663
+
664
+ However, in the case of NativeCall, currently Rakudo requires a space between the
665
+ function argument and the signature, and the colon of a normal Signature
666
+ literal is ommitted, as in:
667
+
659
668
use NativeCall;
660
669
# void SetCallback(int (*callback)(const char *))
661
670
my sub SetCallback(&callback (Str --> int32)) is native('mylib') { * }
You can’t perform that action at this time.
0 commit comments