"C++" classes in "C" code

Hi,

I have two C++ files (classes are defined in that with member functions).I want to use them in "C" files.

Do I need to write compatible wrapper functions for each functions defined in C++ or is there any other way to use "C++" in "C" code ?

Thanks
Priyanshu
if you compile everything as C++ you could get it working with no modification since C++ is mainly a superset of C
If the C part must be compiled with a strictly C compiler you need to write a wrapper
Thanks Bazzy, even I was thinking that I have to write wrapper functions for that, but the problem is that my class is having private instance of other class also........even though can I write wrapper.......

and second thing is that, we are using C++ compiler for all.......so I am not sure if we can restrict it for "C"......as its a legacy code, I can't do much changes....
Nearly all C++ compilers come with a C compiler. I have to ask, though: if you're using a C++ compiler for everything, why not just write it in C++?
Hi Helios,

We have a big code that is written in C, and some code is written in C++......I want to use that C++ code and write our application and then wants to use in C......that's the reason, I am struggling for the same.............
As the code size is big, I can't write again everything in C or C++.....so I have to use both........

Second thing, make files are also legacy code.....I am not sure whether it would be good Idea to change that for the same........
Topic archived. No new replies allowed.