This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6.c; | |
use NativeCall; | |
# A proof of concept for NativeCall "varargs" calls, | |
my $printf = cglobal(Str,'printf',Pointer); | |
my @sxa := ( | |
(Nil => :(Str --> int32)).Map, # arity 0 | |
(Str => :(Str,Str --> int32), Int => :(Str,Int --> int32)).Map # arity 1 | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use NativeCall; | |
constant MAX_BUF_SIZE = 255; # Seems reasonable | |
constant time_t = size_t; # Best guess. | |
my class tm is repr('CStruct') { }; # Fields can be added when needed | |
my sub gmtime(time_t is rw -->tm) is native { * }; | |
my sub strftime(utf8, size_t, Str, tm -->size_t) is native { * }; | |
sub PosixFormat(DateTime:D $time, Str $format) is export { | |
my time_t $t = $time.posix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { -> { note } }(); |