Skip to content

Commit

Permalink
Completes a subsection on Bufs/Blobs refs #1513
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Jun 28, 2018
1 parent 33e27ba commit 607c76d
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions doc/Language/nativecall.pod6
Expand Up @@ -614,9 +614,23 @@ leaks.
=head2 Buffers and blobs
=comment TODO
L<Blob>s and L<Buf>s are Perl 6 way of storing binary data. We can use them for interchange of data with native functions and data structures, although not directly. We will have to use L<C<nativecast>|/routine/nativecast>.
L<Blob>s and L<Buf>s are the Perl 6 way of storing binary data. We can use them
for interchange of data with native functions and data structures, although not
directly. We will have to use L<C<nativecast>|/routine/nativecast>.
=for code :preamble<use NativeCall;>
my $blob = Blob.new(0x22, 0x33);
my $src = nativecast(Pointer, $blob);
This C<$src> can then be used as an argument for any native function that takes
a Pointer. The opposite, putting values pointed to by a C<Pointer> into a C<Buf>
or using it to inialize a C<Blob> is not directly supported. You might want to
use L<C<NativeHelpers::Blob>|https://github.com/salortiz/NativeHelpers-Blob> to
do this kind of operations.
=for code :skip-test<incomplete code>
my $esponja = blob-from-pointer( $inter, :2elems, :type(Blob[int8]));
say $esponja;
=head1 Function arguments
Expand Down

0 comments on commit 607c76d

Please sign in to comment.