-
Combining C && C++ Code
Any Helpful Answer to this Question will be Greatly Appreciated
Do you know of a way to conveniently combine C and C++ source code using Visual C++. extern "C" seems very limited in what can be combined. I have lots of code developed in pure C, and would like to combine it with new C++ code.
Thank you,
-
Re-declare all the C functions you wish to use as extern "C", from within your C++ code. You should then be able to call all the C functions by linking to your libraries, and use any C++.
extern "C" is more limiting the other way around, where you are calling C++ functions from within C code, in which case you'd have no choice but cut out much of the the C++ specific code.
-
From the example that you gave me it sounds like you're trying to use C++ functions in C code. As Sorenson said that's not always so easy.
I've only used C code in a C++ project not the other way around.
You might be looking at changing the code. Good Luck.
-