BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 01-05-2009, 08:11 PM   #1 (permalink)
New Member
 
Join Date: Apr 2008
Model: 8700
PIN: N/A
Carrier: AT&T
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default What JDEs support preprocess?

Please Login to Remove!

Which BlackBerry JDEs support //#preprocess? If 4.2 and 4.3 don't, when will they?

Hilton
Offline  
Old 01-05-2009, 10:52 PM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2005
Model: 8830
Carrier: Verizon
Posts: 144
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hilton,

There's a post on the BlackBerry Support forums that addresses this, but here's a summary. Thanks to Jeremey Weber for this information.

The preprocessor is available in all versions of the JDE.

Edit the .jdp file manually
Find the Options line
Add ‘–define <tag1>;<tag2>;…;<tagN>
e.g.: Options=-quiet
-define= VER_4_2_0_AND_ABOVE;PREPROCESSOR
Note: The –define statement is an argument passed to rapc
Add directives as follows:
Code:
  //#preprocess

  public class Library implements LibraryInterface {
      public MenuItem[] getMenus() {
           MenuItem[] menuItems = null;

          

           //#ifdef VER_4_2_0_AND_ABOVE
           menuItems = new MenuItem[] { new InvokeAB(), InvokeMaps() };
           //#else
           menuItems = new MenuItem[] { new InvokeAB() };
           //#endif

 

           return menuItems;
      }
 }
Apparently the //#preprocess statement needs to be the first line in the source file.

fbrimm
Offline  
Old 01-06-2009, 08:12 PM   #3 (permalink)
New Member
 
Join Date: Apr 2008
Model: 8700
PIN: N/A
Carrier: AT&T
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Yeah, I saw that, but it doesn't answer my original question:

"Which BlackBerry JDEs support //#preprocess? If 4.2 and 4.3 don't, when will they?"

Note that the compiler 'preprocess' lines are prefixed by "//" which means that some JDEs will not recognize the preprocess lines and simply ignore them as comments. But that is a half-assed solution since there is no way of saying "If you are running 4.2 do this, and if not do that; i.e.

//#ifdef VER_4_2
Do this for 4.2
//#else
Do that for not-4.2
//#endif

If you're compiling with a JDE that recognizes preprocess (e.g. 4.7 I assume/think), then it will compile only "Do that for not-4.2", but if you compile with a JDE that does not recognize preprocess, then it will compile both lines.

Now a practical case: I wants to include a few 4.7-only lines for orientation etc. How do I get JDE 4.2 to ignore these lines? If there an updated JDE 4.2 in the works that recognizes preprocess?

As an aside, Apple seem to do everything to help developers (I just spent a full day with them for free), Microsoft have newsgroups and lots and lots of examples etc etc, I know I'll find a solution somewhere. I just find that developing for BB somewhat like pulling teeth. Surely, there should be a white paper on how to "Storminize" our apps, surely there should be information about compilers and what compilers support what features. Another case is a huge memory leak that I pointed out yet no information on when it will be fixed, if it will be fixed, etc other than "our developers are looking at it". Perhaps I'm the only one, but that iPhone platform is sure looking like more fun, easier, better development environment and ecosystem etc.

Having said all this, I would much prefer RIM shipping JDE in which you can select a library version; i.e. DevEnv 1.2 supports 4.2, 4.3, 4.5, 4.6, and 4.7. Then RIM add preprocess and releases DevEnv 1.3 that also supports those OSs. Having a development environment tied to an OS version, IMHO, makes no sense.

OK, so, "Which BlackBerry JDEs support //#preprocess? If 4.2 and 4.3 don't, when will they?"

Hilton
Offline  
Old 01-07-2009, 08:38 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

The Preprocessor has been in the JDE (but not advertised) since 4.0.1

I'm using it to do exactly what you are describing in your post. The down-side is that the directive goes in the project file, so you wind up with a seperate project for each release level.
Offline  
Old 01-07-2009, 02:16 PM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2005
Model: 8830
Carrier: Verizon
Posts: 144
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hilton,

I think you are caught between a rock and a hard place. According to RIM, the version of the JDE you use must match the lowest ver of OS you plan to support (4.2 in your case). But in order to take advantage of the features of the Storm, you need to use the 4.7 JDE.

I suppose you could wrap major sections of your code with preprocess lines for 4.2 or 4.7 and then build your app separately with each JDE, but you might just as well have created 2 separate versions of your app.

I was stuck with a similar situation when the trackball first showed up with OS 4.2. I needed to support devices running OS 4.1 so I had to use the 4.1 JDE. Unfortunately the 4.1 JDE has no idea what a trackball is, so I had to create 2 separate versions of my app.

While I hear your comments regarding the iPhone, at the recent BB Developer Conference I would estimate 20% of the attendees were from the iPhone/Apple side of the universe. I'm not trying to start a religious war "RIM vs Apple", but just that for some reason there were a large number of iPhone developers attending RIM's conference.

Good luck.

fbrimm
Offline  
Old 02-24-2009, 08:29 AM   #6 (permalink)
Knows Where the Search Button Is
 
Join Date: Feb 2008
Model: none
Carrier: sprint
Posts: 24
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wirelessly posted

I have posted a solution for this issue at <a>http://www.blackberryforums.com/developer-forum/177904-solution-jde-preprocessor-defines.html</a>
Lionscribe
Offline  
Old 02-27-2009, 11:59 PM   #7 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2007
Model: 9000
PIN: N/A
Carrier: Rogers
Posts: 36
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by hilton View Post
I just find that developing for BB somewhat like pulling teeth.
You don't know how true that statement is.


M
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2014 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.