05-29-2010 07:14 AM
I would like to port a popular iPhone application I have developped and would like to understand the level of support available for C/C++ within the Blackberry development environment. To clarify, the C/C++ code I would need to run within the BB app does NOT need to be compiled or built in any way or interact with the platform services at all - I am happy writing Java code for that. The C/C++ code in question is pure image processing, image recognition and regular expressions (string processing), with no interaction with the outside world - a self-contained library.
Please tell me it's possible ... it would be impossible for me to port the C library in question to Java, it's just too much code ...
Solved! Go to Solution.
05-29-2010 08:35 AM
Thanks but just clarifying regarding the "3rd party code" mention in your reply: the code is mine, I either wrote it or have the sources & makefiles so I could recompile it under a suitable build environment. Still no go? It's hard to believe that there is *really* no way to take well-written portable C code and build it for the Blackberry!
05-29-2010 10:00 AM
Got it, thanks. This scratches my plans to have that code runs on the BB - our app on the BB will have to be "dumb" and offload the processing to the cloud.
Considering that Blackberry is known to be a smart well-run company, purely out of curiosity, I would love to get more insights about this decision. Today's world is choke full of existing C/C++ code, whether it's entire mobile apps or just specific specialized library code, it is puzzling at best that BB would casually exclude this immense code base from being relevant to the BB! Note that this is one mistake Apple did NOT make, C/C++ is welcome there not only as a .a library or .o object module but also as live code under Xcode.
05-29-2010 11:19 AM
Based on http://blackberryplanetbook.com/index.php/BlackBer
I don't exacly know the reasoning but most of the people here have learned to work around it.
05-29-2010 11:48 PM
05-30-2010 12:03 AM
It's technically possible to have ASM on BlackBerry (or Android, iPhone, etc.) but as you said 3rd-party developers are often not allowed (or not able in the case of BlackBerry) to do so.
OS 6 has a WebKit browser but it has been said that it will actually run almost everything on the phone so you could say that it is a WebKit based OS but that doesn't mean we have to write apps in HTML.
Besides the most often reason for writing C/C++ is A): the dev prefers it. B): The speed is needed. Or C): The library/app is written in it.
By compiling it a second time BlackBerry apps are made more efficient (they are closer to native code from what I remember reading and actually have some RISC opcodes in it) so that eliminates B. A and C you can't really do much about though you can relatively easily port apps/libraries (IMHO).
05-30-2010 05:27 AM
Algorithm code should be easy to translate, indeed I think there are translation programs or scripts, but you have to wonder how fast it will be etc. I've gone back and forth from java to c++ to Symbian without issue except for platform resources. Java tends to be slower due to
code and memory issues but actually translating code should be easy. If you can automate that step, and you probably can, then it shouldn't be an issue to keep one consistent code base. Algorithm code probably doesn't use any fancy OO stuff in the relevant sections but may use some pointer manipulation rather than array index etc.
However, on the larger issue, if you can offload this to cloud or server usually that makes sense
05-30-2010 11:48 AM
Hi, would have barged in sooner into this thread - My company has C code, and I'm the blackberry developer.
To import the code from c to Java, we use an open-source tool that ports code form c to J2ME - http://code.google.com/p/cibyl/.
As RIM OS is an extension of J2ME, this works just fine! Our blackberry application runs Great, a bit slower than our other Iphone/Android versions, but still not bad at all.