c code calling self C++ library

W

Wang WolfLouis

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" {

.....

}

?
 
B

basileis

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.
 
K

Keith Thompson

Wang WolfLouis said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top