CBFalconer <> writes:
> Ian Collins wrote:
>> CBFalconer wrote:
>>> "AL@TW" wrote:
>>>
>>>> How to call a C++ function from c code?
>>>> extern "C++"?
>>>
>>> No. In general, you can't, because of C++ overloading.
> ^^^^^^^^^^^
>>
>> Not that old nonsense again. I though we ponded the truth into
>> you last time around.
>
> And I cavilled above.
The problem is that the phrase "In general" is ambiguous here. I
think what you meant is that it's not always possible, which is true.
An equally reasonable reading is that it's *usually* not possible,
which is not true. (Even in the presence of overloading, you can
provide a uniquely named C++ wrapper.)
In any case, saying that "In general, you can't" is hardly responsive
to a question about how to do it.
Yes, you certainly can call C++ from C. No, you can't always do it;
there are cases where C++ features are incompatible with C, making a
C-to-C++ call impossible or impractical. Since it happens to be C++,
not C, that provides the mechanisms for cross-language calls in both
directions, comp.lang.c++ is the place to ask about it, but only if
the detailed information in the "C++ FAQ Lite" doesn't already answer
the question.
Yes, this is off-topic, but (a) I'm providing a redirection to a forum
where it's topical, and (b) I'm also correcting a statement that's
both off-topic and misleading.
--
Keith Thompson (The_Other_Keith)
kst- <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"