microsoft / Chakra-Samples

Repository for Chakra JavaScript engine related samples.
MIT License
216 stars 84 forks source link

[JsGetArrayBufferStorage] use byte[] as output, should be an IntPtr #65

Closed JohnMasen closed 7 years ago

JohnMasen commented 7 years ago

the wrapper in sample code uses byte[] as output, however, this returns only the first element of the native storage. should use IntPtr as it's actually a pointer. I've changed it in my library to get the actual data. same issue in JsGetTypedArrayStorage and JsGetDataViewStorage

Original: internal static extern JavaScriptErrorCode JsGetArrayBufferStorage(JavaScriptValue arrayBuffer, out byte[] data, out uint bufferLength);

Modified: internal static extern JavaScriptErrorCode JsGetArrayBufferStorage(JavaScriptValue arrayBuffer, out IntPtr data, out uint bufferLength);

liminzhu commented 7 years ago

Thanks for the suggestion @JohnMasen ! Changed in https://github.com/Microsoft/Chakra-Samples/commit/35959e15e4ab378c259618aa34158a68ff442fe0.