Mixing and Compiling of C code on Symbian 3rd Edition
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...) |
bharatuppal
(Talk | contribs) |
||
| Line 27: | Line 27: | ||
</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 | + | 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 | + | 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 | spacw help you will get list of all options supported by the compiler | ||
Revision as of 02:01, 21 July 2007
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]

