From 607c76d4fb8dc5586cf58ab3e6547a34c4c8f285 Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Thu, 28 Jun 2018 18:07:30 +0200 Subject: [PATCH] Completes a subsection on Bufs/Blobs refs #1513 --- doc/Language/nativecall.pod6 | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/Language/nativecall.pod6 b/doc/Language/nativecall.pod6 index 14913271b..e87f7f4b3 100644 --- a/doc/Language/nativecall.pod6 +++ b/doc/Language/nativecall.pod6 @@ -614,9 +614,23 @@ leaks. =head2 Buffers and blobs -=comment TODO - -Ls and Ls 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|/routine/nativecast>. +Ls and Ls 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|/routine/nativecast>. + +=for code :preamble +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 into a C +or using it to inialize a C is not directly supported. You might want to +use L|https://github.com/salortiz/NativeHelpers-Blob> to +do this kind of operations. + +=for code :skip-test +my $esponja = blob-from-pointer( $inter, :2elems, :type(Blob[int8])); +say $esponja; =head1 Function arguments