Hello friends
We know that we can use the extern 'C' {} to use C code in C++.
I want instead to have extern 'C++' {} so that I can use C++ code in C.
But the compiler errors.
Any ideas. THANKS.
This is really a C++ question.
Pay careful attention to Ian's response -- in particular, note that he
said you have to use double quotes around C, not single quote (yes,
such 'small' details are important).
extern "C" actually allows C and C++ code to mix by telling the linker
that the declarations within that block should have C linkage. If you
can convince the linker that your C++ code can have C linkage, then
you should be able to achieve what you want. Of course, this means
you cannot have features exclusive to C++ such as templates,
exceptions, classes, function overloading etc. in your C++ function
declarations within the extern "C" block.
hope this helps,
- Anand