C source migration to CPP

Discussion in 'C++' started by karunesh, Jan 23, 2007.

  1. karunesh

    karunesh Guest

    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
    karunesh, Jan 23, 2007
    #1
    1. Advertising

  2. 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
    Roland Pibinger, Jan 23, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DrUg13
    Replies:
    1
    Views:
    465
    DrUg13
    Feb 10, 2004
  2. Alex Vinokur
    Replies:
    7
    Views:
    402
    Greg Comeau
    Nov 15, 2004
  3. Vinu
    Replies:
    9
    Views:
    615
  4. www.hitechskill.com
    Replies:
    0
    Views:
    1,341
    www.hitechskill.com
    Apr 9, 2006
  5. Boni Satani
    Replies:
    0
    Views:
    160
    Boni Satani
    Jan 9, 2014
Loading...

Share This Page