|
Post by Infabmfy on Nov 8, 2018 11:32:24 GMT
We are create native extension using the feature provided is it possible to pass in instance class as param to static method. I tried defining param as SELF_INSTANCE but in definition it passes a string.
|
|
|
Post by Dmitry Soldatenkov on Nov 8, 2018 14:27:55 GMT
Hi, Currently transfer of instances is not fully supported on not-iOS plaforms. And when you transfer instance you receive ID as String on native side - it is your ID of your object - you has own native factory(see generated code) for request native object by this ID. See ...FactoryBase classes.
|
|
|
Post by infabmfy on Nov 8, 2018 15:02:34 GMT
Oh in that case What would be the recommended way of passing complex data structure between Ruby and native that would work on all platforms cuz we need to work with complex objects that will be passed to native and have third party library do computation on them and give back result. Will Map<String, Object> work in java.
|
|
|
Post by jontara on Nov 12, 2018 20:49:19 GMT
What do you mean by "native"?
"native" is a slippery slope on Android! Do you mean java, or do you mean truly native (C, C++)?
Do you also support iOS? If so, what language do you use for your extension on iOS?
Keep in mind, Rhodes Android build uses the NDK (Native Development Kit). Rhodes itself uses truly native C/C++ code. Note that you need to build your project for both ARM and X86 targets if your app will be expected to run on X86 devices (quite a number of Android tablets).
If your code is true native, it may be advantageous to skip the platform-specific "native" bindings (Objective-C, Java).
We have a native extension that is pure C code doing some image processing. My first attempt at a native extension used the Objective-C/Java bindings, and was a pain, since I had to write "glue code" for each platform. (And we anticipate supporting Windows eventually, so that's yet another set of glue code for C#).
I wound up writing a pure-native C++ extension binding. This avoids having to write code in Objective-C, Java, and C#, all just to call the same C code!
|
|
|
Post by Dmitry Soldatenkov on Nov 12, 2018 21:29:36 GMT
Sure, If you want use your C/C++ code you should write common API C++ based extension - it is possible - our CommonAPI support two way for iOS and Android. You can use wrapper for C++ and write one code for both platforms or use special wrapper for each platform - ObjC on iOS and Java on Android.
Just run rhogen extension Boo in app folder for add extension "Boo" ready to build with ObjC and Java based code for iOS and Android
But you can see generator also prepare C++ code for implement CommonAPI on C++ You can modify your platforms projects for use C++ implementation instead of ObjC/Java wrappers code located in ext/shared/generated/cpp C++ stub implementation in ext/shared/generated/stub
|
|