Mixing and Compiling of C code on Symbian 3rd Edition
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

