c code calling self C++ library

Discussion in 'C Programming' started by Wang WolfLouis, Jul 12, 2011.

  1. Now, I want to use C code calling library which is created by g++,
    how could I define the c++ library header file?
    it should be extern "C" {

    .....

    }

    ?
    Wang WolfLouis, Jul 12, 2011
    #1
    1. Advertising

  2. Wang WolfLouis

    basileis Guest

    On Jul 12, 11:15 am, Wang WolfLouis <> wrote:
    > Now, I want to use C code calling library which is created  by g++,
    > how could I define the c++ library header file?
    > it should be extern "C" {
    >
    > ....
    >
    > }
    >
    > ?


    Whatever function or variable exposed in extern "C" block can be used
    by C source . A function which is declared to have C linkage can use
    all the features of C++ but it's parameter and return type should be
    accessible from C source from where you are calling this code.
    basileis, Jul 12, 2011
    #2
    1. Advertising

  3. Wang WolfLouis <> writes:
    > Now, I want to use C code calling library which is created by g++,
    > how could I define the c++ library header file?
    > it should be extern "C" {
    >
    > ....
    >
    > }
    >
    > ?


    C++ defines features for C++ code calling C, and C calling
    C++. C does not. So a C++ newsgroup will likely get you
    better information. But first, take a look at the C++ FAQ,
    <http://www.parashift.com/c++-faq-lite/>, particularly section 32.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Jul 12, 2011
    #3
    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. Ralf W. Grosse-Kunstleve
    Replies:
    16
    Views:
    561
    Lonnie Princehouse
    Jul 11, 2005
  2. Ralf W. Grosse-Kunstleve
    Replies:
    18
    Views:
    582
    Bengt Richter
    Jul 11, 2005
  3. Ralf W. Grosse-Kunstleve
    Replies:
    2
    Views:
    390
    Dan Sommers
    Jul 12, 2005
  4. falcon
    Replies:
    0
    Views:
    362
    falcon
    Jul 31, 2005
  5. Bart Kastermans
    Replies:
    6
    Views:
    386
    Bart Kastermans
    Jul 13, 2008
Loading...

Share This Page