Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > C source migration to CPP

Reply
Thread Tools

C source migration to CPP

 
 
karunesh
Guest
Posts: n/a
 
      01-23-2007
hi there,

we have a product which is written fully in c. now i have to migrate
this source to cpp.
as some of our client want our Libs in cpp. so can you help me what
step will be Evolve.

our tool is Graphics SDK which gives facility to design you GUI at
desktop side and then this write c code of the same and there is target
side code which contain the definitions of those source. it work on
different Embedded platform.

now question is what step should we take so that we can support both c
and cpp.

we are even ready to write the whole SDK from scratch.

Please through some light .

Regards,
Karunesh

 
Reply With Quote
 
 
 
 
Roland Pibinger
Guest
Posts: n/a
 
      01-23-2007
On 22 Jan 2007 22:54:38 -0800, "karunesh" wrote:
>we have a product which is written fully in c. now i have to migrate
>this source to cpp.
>as some of our client want our Libs in cpp. so can you help me what
>step will be Evolve.


C++ is almost a superset of C. Just compile your source with a C++
compiler and correct the errors. Especially you need to cast the
return value of *alloc and rename identifiers that are reserved words
in C++ (e.g. new, delete, class, ...).

>now question is what step should we take so that we can support both c
>and cpp.


Declare your (exported) functions as extern "C". Then you can use the
compiled library from C and C++, e.g.

#ifdef __cplusplus
extern "C" {
#endif

void foo (int i);
// other functions

#ifdef __cplusplus
}
#endif

Best regards,
Roland Pibinger
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Free online test in C, CPP / Placement papers / CPP,C Interview Questions www.hitechskill.com C++ 0 04-09-2006 10:53 AM
when i compile the cpp file(cmdargs.cpp) int main(int argc, wchar_t* argv[]) Vinu C++ 9 05-05-2005 04:11 AM
Method inlined in source1.cpp and called in source2.cpp Alex Vinokur C++ 7 11-15-2004 09:14 PM
Cpp source code ANSWER C++ 2 08-25-2004 02:56 PM
What is better /standard for creating files. a cpp file with header or cpp and seperate file for header DrUg13 C++ 1 02-10-2004 09:20 AM



Advertisments