Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Platform macros

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: stenlik (02 Mar 2008)
Last edited: hamishwillee (25 Jul 2012)

Introduction

When the application is ported to the UIQ platform or backported to the older SDK the code must be changed on some places. The ideal way is to put some #ifdef with the platform macros, but unfortunately there is missing some simple way how to do that. I have found two ways how to define platform macros.

Platform macros


  • First approach

1. Use the following header file:

 #ifndef _SYMBIAN_OS_PLATFORM_H__
 #define _SYMBIAN_OS_PLATFORM_H__
 
 #include <e32def.h>
 
 #ifdef EKA2
   
   #define __SDK_EKA2__
   
   #ifdef UIQ_UMTS_AVAILABLE
     // UIQ 3, 3.1...
     #define __SDK_UIQ3__
   #else
     #ifdef __HIDE_IPC_V1__
       // S60 Symbian(v9.1, v9.2) 3rd
       #define __SDK_60_3RD__
     #endif
   #endif
 #else
   #ifdef __PLATSEC_DIAGNOSTIC_STRING
     // S60 Symbian(8.0a, v8.1a) 2nd FP2, (FP3?), i.e. EKA 1
     #define __SDK_S60_2ND_FP2__
   #else
     // EKA1: S60 Symbian(7.0s, 6.1), (FP1?) UIQ 2.0 also
     #define __SDK_S60_2ND_PRE_FP2__
   #endif
 #endif
 
 #endif



  • Second approach

2. Use the Perl script to prepare the header file automatically from devices command output. It can be part of the bld.inf file and is ideal way for script building:

 $command_output = `devices -default`;
 $device = substr($command_output, length("Default device: "),  
           length($command_output)-$length );
 
 open(PLATFORM_HEADER,">"."SymbianPlatform.h");
 print PLATFORM_HEADER "#ifndef __SYMBIAN_PLATFORM__\r\n#define
       __SYMBIAN_PLATFORM__\r\n#define __SDK_".substr($device, 0, index($device, ":" ) 
       )."__\r\n#endif\r\n".$root;
 close(PLATFORM_HEADER);

It produces header files like following:

 #ifndef __SYMBIAN_PLATFORM__
 #define __SYMBIAN_PLATFORM__
   
 #define __SDK_UIQ3__
   
 #endif

Example could be downloaded File:Symbian Platform Macros.zip. here

This page was last modified on 25 July 2012, at 05:39.
35 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×