00:03 thowe joined 00:08 jgaz left 02:26 frost joined 05:17 Oshawott joined 05:20 archenoth left 06:14 archenoth joined 06:16 Oshawott left 06:17 Oshawott joined 06:21 archenoth left 06:34 Oshawott left 08:01 lizmat joined 09:06 saint- left 12:07 jgaz joined 13:14 frost left 15:21 ChanServ sets mode: +o lizmat
lizmat This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
15:22 ChanServ sets mode: -o lizmat 16:28 discord-raku-bot left 16:29 discord-raku-bot joined 16:34 razetime joined 17:01 razetime left 18:39 Util joined 19:47 n1to joined 20:58 paurq joined
paurq Hi! I'm trying to call C memset using NativeCall, but i'm having issues making it portable for linux and windows. From reading the docs i thought this should work everywhere: 21:10
sub memset(Pointer $str, int32 $c, size_t $n) returns Pointer is native {*}
But that only works on linux, to make it work on windows i have to use this:
sub memset(Pointer $str, int32 $c, size_t $n) returns Pointer is native('ucrtbase') {*}
Am I missing something? or is there a way to select one version or the other depending on the OS?
21:11 n1to left
gfldex my &memset = %*KERNEL ~~ /win32/ ?? sub (Pointer $str, int32 $c, size_t $n) returns Pointer is native('ucrtbase') {*} !! sub (Pointer $str, int32 $c, size_t $n) returns Pointer is native {*}; 21:14
paurq: ^^^ something along those lines should work
and yes, C-land is not overly portable 21:15
paurq thanks! It works with a couple changes: 21:26
my &memset = $*KERNEL ~~ /win32/
        ?? sub (Pointer $str, int32 $c, size_t $n) returns Pointer is symbol('memset') is native('ucrtbase') {*}
        !! sub (Pointer $str, int32 $c, size_t $n) returns Pointer is symbol('memset') is native {*};
21:46 jgaz left 22:51 jgaz joined
jgaz How do I slurp a binary file with `my $data = slurp($file_name)` or similar? 23:17
NM, I think I have it: `slurp($file_name, :bin)` if I'm not mistaken. 23:22
23:24 jgaz left
guifa jgaz: yup, that works 23:49