Replies: 1 comment 1 reply
-
Don't know about the method but you'll probably want to convert it into UInt8Array byte array, ArrayBuffer for binary data. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm using this scaffolding project to create a react-native library that must call a low level c++ library to encode/decode messages for a custom serial protocol.
Most of the native C++ functions simply return an "unsigned char *" buffer containing the encoded message bytes.
In iOS I'm able to return this buffer by converting it to a NSData object and then converting it to a NSArray.
In Android, at JAVA level, the return type is mapped by Codegen to WritableArray (the RN spec return value is "number[]").
Then in JNI (cpp-adapter.cpp), where the C++ calls are made, the return value type is "jobject" (I've also tried by using jbyteArray but nothing changes).
cpp-adapter.cpp
LibcustomModule.java
When the call is made the Android app crashes with a SIGABRT.
Other methods returning "number" (mapped to jdouble) works well.
In iOS everything works without problems.
Which is the right method to return a byte array from c++ to typescript in Android?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions