You Are Here:

Community: Wiki

This page was last modified on 24 June 2008, at 14:59.

Platform macros

From Forum Nokia Wiki

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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia