Re: c++ calling c functions
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Thu, 06 Dec 2007 00:20:24 -0500
Keith Thompson wrote:
CBFalconer <cbfalconer@xxxxxxxxx> writes:
[...]
No, you can't link C++ to C, in general.
I don't believe that's correct. Further information would be
topical in comp.lang.c++, not in comp.lang.c (since it's C++, not
C, that defines the mechanisms), but see questions 32.5 and 32.6
in the "C++ FAQ Lite" at <http://www.parashift.com/c++-faq-lite/>.
The point is that C++ function names are modified, to express the
parameter types, in the linkable object code sections. C does not
do this, since it doesn't have shared function names etc. Thus the
C++ code can be told (with the "extern C {...}") that selected C
functions are to be accessed (from C++) with unmodified names. The
reverse is not possible.
Thus I gave the general method for making C object code available
to aa C++ program.
Maybe we are confusing the direction of linking? You can call C
from C++, but not C++ from C (without impossible diddling).
--
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
.
- Follow-Ups:
- Re: c++ calling c functions
- From: James Kuyper
- Re: c++ calling c functions
- From: Keith Thompson
- Re: c++ calling c functions
- From: Ian Collins
- Re: c++ calling c functions
- References:
- c++ calling c functions
- From: teju
- Re: c++ calling c functions
- From: CBFalconer
- Re: c++ calling c functions
- From: Bill Reid
- Re: c++ calling c functions
- From: CBFalconer
- Re: c++ calling c functions
- From: Keith Thompson
- c++ calling c functions
- Prev by Date: Re: Dynamic Array Size
- Next by Date: Re: c++ calling c functions
- Previous by thread: Re: c++ calling c functions
- Next by thread: Re: c++ calling c functions
- Index(es):