--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to native-client-di...@googlegroups.com.
To post to this group, send email to native-cli...@googlegroups.com.
Visit this group at http://groups.google.com/group/native-client-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
You can just create one of the size you need:
https://developers.google.com/native-client/peppercpp/classpp_1_1_var_array_buffer#a7fd29347661fc1539dd474cc3f0e2a72
then write to it, probably using memcpy.E.g.:pp::VarArrayBuffer buffer(num_bytes);memcpy(buffer.Map(), data, num_bytes);instance->PostMessage(buffer);
Let me know if this doesn't work for you.
On Tue, Feb 19, 2013 at 10:23 PM, DevelopDaily <c...@datacivilization.com> wrote:
It seems to me that it is easy to use pp::VarArrayBuffer to transfer binary data from the Chrome/JavaScript to the NaCl, but not vice versa.
I have a chunk of bytes produced in the NaCl, but I cannot find a way to construct a pp::VarArrayBuffer object to transfer the bytes to the JavaScript. Did I miss something?
Thanks.
--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to native-client-discuss+unsub...@googlegroups.com.
Hello David
I am using your code template to transfer a simple uint8* array from PNaCl to javascript.uint8_t array[] = {120,120,120,120};struct PP_Var data = PSInterfaceVarArrayBuffer()->Create(num_bytes);memcpy(PSInterfaceVarArrayBuffer()->Map(data), array, sizeof(array));PSInterfaceMessaging()->PostMessage(PSGetInstanceId(), data);
But on the javascript side I am getting an empty ArrayBuffer. Can you please tell me what the problem might be?
On Thursday, 21 February 2013 02:00:11 UTC+5, David Michael wrote:
You can just create one of the size you need:
https://developers.google.com/native-client/peppercpp/classpp_1_1_var_array_buffer#a7fd29347661fc1539dd474cc3f0e2a72
then write to it, probably using memcpy.E.g.:pp::VarArrayBuffer buffer(num_bytes);memcpy(buffer.Map(), data, num_bytes);instance->PostMessage(buffer);
Let me know if this doesn't work for you.
On Tue, Feb 19, 2013 at 10:23 PM, DevelopDaily <c...@datacivilization.com> wrote:
It seems to me that it is easy to use pp::VarArrayBuffer to transfer binary data from the Chrome/JavaScript to the NaCl, but not vice versa.
I have a chunk of bytes produced in the NaCl, but I cannot find a way to construct a pp::VarArrayBuffer object to transfer the bytes to the JavaScript. Did I miss something?
Thanks.
--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to native-client-di...@googlegroups.com.