Mixing and Compiling of C code on Symbian 3rd Edition
m |
hamishwillee
(Talk | contribs) m (Hamishwillee - Bot update - Add ArticleMetaData) |
||
| (One intermediate revision by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | Imagine you have | + | {{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 | + | 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 | + | int my_ctype_interface_open(char* msgq_buf_p,int msg_size); |
</code> | </code> | ||
| − | Now | + | 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 | + | 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 | + | 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 | + | 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 | Now in .CPP files you can implement the code containng C++ Syntax | ||
| Line 36: | Line 58: | ||
OPTION CW -w implicit -lang c++ | OPTION CW -w implicit -lang c++ | ||
</code> | </code> | ||
| − | This tells | + | This tells the compiler to suppress all typecasting errors, |
| − | for more such options go to the command prompt | + | for more such options go to the command prompt type the compiler name with |
| − | spacw help | + | 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 45: | Line 67: | ||
</code> | </code> | ||
| − | Also Visit the Following link [[ | + | 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:Code | + | [[Category:Symbian C++]][[Category:Porting]][[Category:Multi-Platform Development]][[Category:Code Snippet]] |
Latest revision as of 01:59, 26 July 2012
Article Metadata
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

