diff --git a/doc/Language/nativecall.pod6 b/doc/Language/nativecall.pod6 index 1513758db..2ec9eb9ee 100644 --- a/doc/Language/nativecall.pod6 +++ b/doc/Language/nativecall.pod6 @@ -286,7 +286,22 @@ type of a native function, the memory is not managed for you by the GC. NativeCall currently doesn't put object members in containers, so assigning new values to them (with =) doesn't work. Instead, you have to bind new values to the private -members: C<$!struct-member := StructObj.new;> +members: + + class MyStruct is repr('CStruct') { + has CArray[num64] $!arr; + has Str $!str; + has IntStruct $!int-struct; + + submethod TWEAK { + my $arr := CArray[num64].new; + $arr[0] = 0.9e0; + $arr[1] = 0.2e0; + $!arr := $arr; + $!str := 'Perl 6 is fun'; + $!int-struct := IntStruct.new; + } + } As you may have predicted by now, a null is represented by the type object of the struct type.