Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Mixing and Compiling of C code on Symbian 3rd Edition

From Wiki
Jump to: navigation, search
Article Metadata
Article
Created: bharatuppal (20 Jul 2007)
Last edited: hamishwillee (25 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 25 July 2012, at 22:59.
45 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.

×