I am currently hacking around on a new DRM system for my applications which – surprise, surprise – will include OTA wherever its possible (aka at MobiHand’s). As I need to use variable URL’s for each distributor, I felt like using the preprocessor.

As I stumbled across a few interesting things, I felt like sharing the code below:

#if defined MOBIHAND
WBM_OpenWebPage(0,"https://www.mobihand.com/mobilecart/mc1.asp?posid=162&pid=8703");
#elif defined PALMGEAR
WBM_OpenWebPage(0,"http://www.palmgear.com/index.cfm?fuseaction=sc.buy&prodid=137239&buytoken=62745661");
#else
#error "no ESD Specified"
#endif

The first thing that I considered interesting is the #error macro – it allows you to stop the compilation process if some condition is not met. In the example above, the condition would be that no ESD flag is set. Furthermore, nesting definitions isn’t too easy either – the syntax involves the defined operator (which the PODS does NOT highlight).

Related posts:

  1. PODS errors-cascaded
  2. Creating Multi-Segment applications with PODS
  3. PODS does not find every error
  4. Alex Bloom video interview
  5. On showing error messages

One Response to “PODS preprocessor trickery – raise errors from the preprocessor”

  1. Ive been absent for a while, but now I remember why I used
    to love this website. Thanks, Ill try and check back more frequently.
    How frequently you update your site?

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

© 2013 TamsPalm - the Palm OS / web OS Blog Suffusion theme by Sayontan Sinha