i have a code written in c now merged with c++ code i mean i
am calling c functions in c++ using extern "C" but now i want
to use some objects declared and defined in c++ to be
available in c code.
To be made available in what way? There's certainly no problem
in passing the address of a C++ object through C code, e.g. as a
void*. On the other hand, there's no way C code will be able to
call virtual functions, using the C++ syntax.
If you want to use some new C++ object in the C code, you're
going to have to modify the C code. (For that matter, if you
were going to use some new C object in the code, you'd have to
modify it.) If you modify it, why not just switch to C++? If
the C is well written, it should compile with few changes as
C++, and you can gradually migrate it to more idiomatic C++,
using new C++ objects as desired. If parts of the code still
have to be called from C, you can declare them extern "C", and
still use all of the C++ facilities in the function itself. All
extern "C" says is that the C++ compiler should use the C
calling conventions.