well it is not really convenient when you are modifying an already existing cn1 lib and can't override the native files you already wrote. Also, the generated native interface do not give you any hint on how to convert you native object to the expected interface binding object when these differ. For example in objective C, if I have an NSArray or an NSMutableArray holding my primitives how must I convert it to NSData* before returning it (there is different methods using NSKeyedArchiver or NSPropertyListSerialization and I don't which one to use since I have no information on the deserialisation method CN1 is using to bind it back to java arrays of primitives..). In any case you should fix the documentation on native interfaces types mapping and rules On Thursday, September 12, 2019 at 2:23:27 AM UTC+2, Steve Hannah wrote: > > The easiest way to see is just to create a native interface and then > generate the native implementations using the IDEs “generate native > interfaces” option. > > On Wed, Sep 11, 2019 at 5:01 PM Thomas <[email protected] <javascript:>> > wrote: > >> I need to return an array of primitives ( a double[] ) as the result of a >> native call in a NativeInterface. However, even if I guess it is possible, >> I could not find any example of this in the documentation or the various >> cn1libs I already looked at. And I don't know what would be the correct >> mapping for this in the diiferent native languages (the mapping table given >> into >> https://www.codenameone.com/manual/advanced-topics.html#_native_interfaces >> is >> a complete mess with column headers that do not match the types in the rows >> (since when do Java have a NSData* type or Android a BOOL one for >> example?) and a "byte" column that isn't a language and do not make any >> sense (at least without any additional explanation, it is completely >> incomprehensible). You really shoud fix this part of the documentation!) >> >> So, if, in my NativeInterface I define a function like this: >> >> public double[] myfunction(); >> >> what woud be its mapping in the various languages (c# for ioS, >> javascript...)? >> >> for example for iOS would it be >> >> (double[]) myfunction {} >> >> or >> >> (NSData*) myfunction {} >> >> or something else...? >> >> >> same question if I would like to return a byte[] array instead of a >> double[] one >> >> -- >> You received this message because you are subscribed to the Google Groups >> "CodenameOne Discussions" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/codenameone-discussions/dfa74779-54c4-46ff-b55a-a923111225b6%40googlegroups.com >> >> <https://groups.google.com/d/msgid/codenameone-discussions/dfa74779-54c4-46ff-b55a-a923111225b6%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > Steve Hannah > Software Developer > Codename One > http://www.codenameone.com >
-- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/918c7fb9-2325-4b8b-9601-8f281f547244%40googlegroups.com.
