Porting C library to Java for Blackberry applicati

2019-01-26 19:37发布

问题:

I need to port a C library to Java so it can run on the Blackberry platform (mobile, native application). The options I am considering are:

  1. bytecode conversion (cibyl, etc)
  2. Complete port
  3. Wrap C code around Java using JNA (would this even work for Blackberry?)

Please let me know which option is best. thanks

回答1:

Aha. Some quick googling says "No, JNI does not work for blackberry" source:

http://supportforums.blackberry.com/t5/Java-Development/Can-we-use-JNI-Java-Native-Interface-approach-in-Blackberry/m-p/365362

http://supportforums.blackberry.com/t5/Java-Development/JNI/m-p/41140.

So you're stuck with bytecode conversion and complete port. Since I have no idea what bytecode conversion is, I'd go with a complete port, so long as you are familiar with both languages. If you can define bytecode conversion for me, I might be able to give you a better answer.



回答2:

We also have an in-house developed C library for core functionality of our iOS and Android apps.

I asked about using cibyl to run this on BlackBerry in the form of a .jar and the good news is that it's possible: https://twitter.com/#!/simonkagstrom/status/114581622833152000 [backup of the tweet: "Sure, that's how #waze on the blackberry works."]

You can also try MoSync: http://twitter.com/#!/MoSync/status/115088826430533632 [backup of this one: "Yup, you can use MoSync for BB. There's "experimental" Blackberry support in MoSync 2.6, already used in live apps!"]

And David A Roberts, developer of LLJVM sent me this: "I'm not familiar with BlackBerry development, but I see no obvious reason why LLJVM wouldn't work, so long as the library doesn't rely too much on things like the C POSIX library (e.g. dirent.h, etc) - I never got around to implementing this fully. Otherwise LLJVM would need to be updated suitably..."

Side note: BlackBerry's new Tablet OS and planned BBX phones actually have a native SDK but this QNX based stuff is quite unpopular. We just need to wait if BBX is going to become a success since Java based solutions are just too much risks.