×
Namespaces

Variants
Actions
(Difference between revisions)

Mixing and Compiling of C code on Symbian 3rd Edition

From Nokia Developer Wiki
Jump to: navigation, search
bharatuppal (Talk | contribs)
(New page: Imagine you have following C type interfaces <code cpp> int my_ctype_interface_create(char* msgq_buf_p, int msg_size); void my_ctype_interface_send(char* msgq_buf_p,int msg_size); int m...)
 
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Add ArticleMetaData)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Imagine you have following C type interfaces
+
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20070720
 +
|author= [[User:Bharatuppal]]
 +
}}
 +
Imagine you have following C type interfaces
 
<code cpp>
 
<code cpp>
 
  int my_ctype_interface_create(char* msgq_buf_p, int msg_size);
 
  int my_ctype_interface_create(char* msgq_buf_p, int msg_size);
void my_ctype_interface_send(char* msgq_buf_p,int msg_size);
+
void my_ctype_interface_send(char* msgq_buf_p,int msg_size);
 
int my_ctype_interface_recieve(char* msgq_buf_p, int msg_size);
 
int my_ctype_interface_recieve(char* msgq_buf_p, int msg_size);
int my_ctype_interface_open(char* msgq_buf_p,int msg_size);
+
int my_ctype_interface_open(char* msgq_buf_p,int msg_size);
 
</code>
 
</code>
Now for properly compiling c type interfaces in  .h and .cpp files  
+
Now for properly compiling c type interfaces in  .h and .cpp files  
 
follow the below steps
 
follow the below steps
  
Line 16: Line 38:
  
 
   
 
   
void my_ctype_interface_send(char* msgq_buf_p,int msg_size);
+
void my_ctype_interface_send(char* msgq_buf_p,int msg_size);
 
int my_ctype_interface_recieve(char* msgq_buf_p, int msg_size);
 
int my_ctype_interface_recieve(char* msgq_buf_p, int msg_size);
 
                                      
 
                                      
int my_ctype_interface_open(char* msgq_buf_p,int msg_size);
+
int my_ctype_interface_open(char* msgq_buf_p,int msg_size);
  
  
Line 27: Line 49:
 
</code>
 
</code>
  
The above code tells the '''c++ compiler''' that the defination of the interfaces are defined at some other place
+
The above code tells the '''c++ compiler''' that the defination of the interfaces are defined at some other place.
 +
 
 +
Now in .CPP files you can implement the code containng C++ Syntax
 +
and API's
  
Also Make the following changes in MMP file  
+
Also make the following changes in MMP file  
 
<code cpp>
 
<code cpp>
 
OPTION CW -w implicit -lang c++
 
OPTION CW -w implicit -lang c++
 
</code>
 
</code>
This tells the compiler to   suppress all typecasting error
+
This tells the compiler to suppress all typecasting errors,
For more such options go to the command prompt type the compiler name with
+
for more such options go to the command prompt type the compiler name with
spacw help you will get list of all options supported by the compiler
+
spacw help you will get list of all options supported by the compiler
  
 
'''Add the following Headers & Library in your project'''<code cpp>
 
'''Add the following Headers & Library in your project'''<code cpp>
Line 42: Line 67:
 
</code>
 
</code>
  
Also Visit the Following link  [[http://wiki.forum.nokia.com/index.php/Compiling_C-_code_for_3rd_Edition_Target_Devices_%28UREL_mode%29 Compilation of C Code on Target]]  
+
Also Visit the Following link  [[Compiling C- code for 3rd Edition Target Devices (UREL mode)|Compilation of C Code on Target]]  
  
           [[Category:Symbian C++]][[Category:Porting]][[Category:Multi-Platform Development]]
+
           [[Category:Symbian C++]][[Category:Porting]][[Category:Multi-Platform Development]][[Category:Code Snippet]]

Latest revision as of 01:59, 26 July 2012

Article Metadata
Article
Created: bharatuppal (20 Jul 2007)
Last edited: hamishwillee (26 Jul 2012)

Imagine you have following C type interfaces

 int my_ctype_interface_create(char* msgq_buf_p, int msg_size);
void my_ctype_interface_send(char* msgq_buf_p,int msg_size);
int my_ctype_interface_recieve(char* msgq_buf_p, int msg_size);
int my_ctype_interface_open(char* msgq_buf_p,int msg_size);

Now for properly compiling c type interfaces in .h and .cpp files follow the below steps

#ifdef __cplusplus
extern "C" {
#endif
int my_ctype_interface_create(char* msgq_buf_p, int msg_size);
 
 
void my_ctype_interface_send(char* msgq_buf_p,int msg_size);
int my_ctype_interface_recieve(char* msgq_buf_p, int msg_size);
 
int my_ctype_interface_open(char* msgq_buf_p,int msg_size);
 
 
#ifdef __cplusplus
}
#endif

The above code tells the c++ compiler that the defination of the interfaces are defined at some other place.

Now in .CPP files you can implement the code containng C++ Syntax and API's

Also make the following changes in MMP file

OPTION CW -w implicit -lang c++

This tells the compiler to suppress all typecasting errors, for more such options go to the command prompt type the compiler name with spacw help you will get list of all options supported by the compiler

Add the following Headers & Library in your project
#include <stdlib.h>
LIBRARY estlib.lib

Also Visit the Following link Compilation of C Code on Target

This page was last modified on 26 July 2012, at 01:59.
48 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.

×