A follow-up to my initial message. I think the following is relevant:
https://github.com/rakudo/rakudo/issues/3633 I think my inlined array is actually being filled with zero's. say $a.a[0]; say $a.a[1]; Yields: 0 0 I'm using the comma ide: >raku -v Welcome to Rakudo(tm) v2020.12. Implementing the Raku(tm) programming language v6.d. Built on MoarVM version 2020.12. ~Paul On Sat, Jan 2, 2021 at 11:13 PM Paul Procacci <pproca...@gmail.com> wrote: > Hey gents (again), > > I'm having on awful time with decoding UTF16LE character sequences that > are placed into a Nativecall CArray that I've defined as an interface > between Raku and a windows library call. > > The structure used by the windows function includes a static wchar_t field > that's PATH_MAX in > length (260 wchar_t's). It would look like the following in C: > > struct Something { > int32_t dwSize; > wchar_t a[260]; > }; > > I've written the following as the Raku counterpart to the above: > > class Something is repr('CStruct') { > has int32 $.dwsize; > HAS int16 @.a[260] is CArray; > }; > > Given the following definition for the windows library call: > > bool Test(Something *x); > > .. I've defined the following on the raku side of things: > > sub Test(Pointer --> Bool) is native('Kernel32') { * }; > > ---------------------------------------------------------- > > The function is supposed to write characters into the space allotted, > namely a. > The only required set member prior to calling the subroutine is that the > size of the structure. > It gets set in dwSize like so: > > my Something $a .= new(:dwSize(nativesizeof(Something))); > > Then the actual function call from the raku side of things: > > Test(nativecast(Pointer, $a)); > > ---------------------------------------------------------- > > All the above is working. What I'm trying to attempt to do now is display > the contents of that > CArray (raku member a). In my mind, this is an "array of utf16LE byte > sequences terminated by 0". > > What's the cleanest way of doing this in raku? I've tried variations of > "join" and "encode", simple printf's, say's, etc., and even tried > manipulating this data with Buf's, but I can't seem to get it quite right. > > Any help is appreciated. > ~Paul > -- > __________________ > > :(){ :|:& };: > -- __________________ :(){ :|:& };: