c interface with c++ implementation

Discussion in 'C Programming' started by zade, Jun 28, 2007.

  1. zade

    zade Guest

    I want to create a library with c interface but with c++
    implementation. But I don't know if there exist some potential
    problems.
    Any advice? thanks!
    zade, Jun 28, 2007
    #1
    1. Advertising

  2. zade <> writes:
    > I want to create a library with c interface but with c++
    > implementation. But I don't know if there exist some potential
    > problems.
    > Any advice? thanks!


    C doesn't define an interface to C++.

    C++, however, does define an interface to C, using 'extern "C"'.

    So despite the fact that your question has to do with both C and C++,
    comp.lang.c++ is the right place to ask it.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Jun 28, 2007
    #2
    1. Advertising

  3. On Wed, 27 Jun 2007 17:40:42 -0700, zade <>
    wrote:

    >I want to create a library with c interface but with c++
    >implementation. But I don't know if there exist some potential
    >problems.
    >Any advice? thanks!


    Ask in a newgroup where your compilers are topical.


    Remove del for email
    Barry Schwarz, Jun 28, 2007
    #3
  4. "zade" <> wrote in message
    news:...
    >I want to create a library with c interface but with c++
    > implementation. But I don't know if there exist some potential
    > problems.
    > Any advice? thanks!
    >

    No real problems. You need to declare every function you export as "extern
    C" in C++, and of course not overload or use other C++ specials.
    You will need a C++ compiler to compile the C++ source, of course.

    --
    Free games and programming goodies.
    http://www.personal.leeds.ac.uk/~bgy1mm
    Malcolm McLean, Jun 28, 2007
    #4
    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. Maciek Zywno
    Replies:
    0
    Views:
    366
    Maciek Zywno
    Feb 19, 2004
  2. Will
    Replies:
    3
    Views:
    5,833
  3. Michael Tsang
    Replies:
    32
    Views:
    1,086
    Richard Bos
    Mar 1, 2010
  4. Michael Tsang
    Replies:
    54
    Views:
    1,174
    Phil Carmody
    Mar 30, 2010
  5. sanket
    Replies:
    7
    Views:
    984
    Tsung
    Nov 3, 2011
Loading...

Share This Page