Re: call c++ function from c
CBFalconer wrote:
I think you are completely missing the point about it working both ways,
never mind.
--
Ian Collins.
CBFalconer wrote:
Chris Torek wrote:
>
The C++ system attempts to adorn external calls with information
about parameters, etc. in various ways. The C system has no way of
understanding this mess. Thus C can't call C++ bcause the
'adornments' are missing. However, C++ has a provision for
dropping those 'adornments' to call precompiled C code.
>
>CBFalconer <cbfalconer@mai neline.netwrote :
>>
>Actually, it works both ways, provided some reasonably obvious
>and straightforward restrictions are met.
>>
>(It is possible to write C++ code that can*not* call C code, nor
>vice versa; and mixing one vendor's C compiler with another's C++
>compiler can result in various disasters, but this is equally true
>for mixing one vendor's C compiler with another vendor's C compiler.
>But if the calls can be done at all, the C++ extern "C" method is
>almost always the way to go. Further discussion about this really
>belongs in comp.lang.c++ and/or vendor-specific newsgroups, of
>course.)
>>
>>[Using C++'s extern "C" construct] enables C++ to call C, not
>>the reverse direction.
>>the reverse direction.
>and straightforward restrictions are met.
>>
>(It is possible to write C++ code that can*not* call C code, nor
>vice versa; and mixing one vendor's C compiler with another's C++
>compiler can result in various disasters, but this is equally true
>for mixing one vendor's C compiler with another vendor's C compiler.
>But if the calls can be done at all, the C++ extern "C" method is
>almost always the way to go. Further discussion about this really
>belongs in comp.lang.c++ and/or vendor-specific newsgroups, of
>course.)
The C++ system attempts to adorn external calls with information
about parameters, etc. in various ways. The C system has no way of
understanding this mess. Thus C can't call C++ bcause the
'adornments' are missing. However, C++ has a provision for
dropping those 'adornments' to call precompiled C code.
>
never mind.
--
Ian Collins.
Comment