Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
patrickq
Posts: 4
Registered: ‎05-29-2010
My Device: Bold
Accepted Solution

C/C++ support?

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 ...

Developer
tom_s
Posts: 73
Registered: ‎07-16-2008
My Device: Not Specified

Re: C/C++ support?

Sorry, but you're out of luck. You cannot run third party C/C++ code on the BlackBerry.

New Contributor
patrickq
Posts: 4
Registered: ‎05-29-2010
My Device: Bold

Re: C/C++ support?

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!

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: C/C++ support?

Nope.

 

New Contributor
patrickq
Posts: 4
Registered: ‎05-29-2010
My Device: Bold

Re: C/C++ support?

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.

Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: C/C++ support?

Based on http://blackberryplanetbook.com/index.php/BlackBerry_Nation_Timeline, BlackBerry has been all Java since 2000.

 

I don't exacly know the reasoning but most of the people here have learned to work around it.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
cwong15
Posts: 193
Registered: ‎02-27-2009
My Device: Not Specified

Re: C/C++ support?

It's technically possible to have C/C++ code in a BlackBerry. After all, we keep hearing about the WebKit-based browser that will be in OS 6, and WebKit is written in C++. But unfortunately there is a big difference between what is technically possible and what is possible for a third party developer. Right now, it's still Java all the way (or JavaScript/HTML).

Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: C/C++ support?

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).

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: C/C++ support?

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

Regular Contributor
dan12345
Posts: 64
Registered: ‎02-03-2010
My Device: Bold

Re: C/C++ support?

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.

 

Dan