[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

c code calling self C++ library

Wang WolfLouis

7/12/2011 6:16:00 AM

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

.....

}

?
2 Answers

basileis

7/12/2011 6:28:00 AM

0

On Jul 12, 11:15 am, Wang WolfLouis <wolflouisw...@gmail.com> 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.

Keith Thompson

7/12/2011 3:37:00 PM

0

Wang WolfLouis <wolflouiswang@gmail.com> 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..., particularly section 32.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.ne...
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"