In c program, I want run c++ library function(s), but I don’t know how can I do that. Like ever c++ programmer, I know how to use c program under c++ prog. therefore, I wonder it is possible using c++ library function, namely cout, vector etc., in c ?
Share
Generally, you cannot use C++ facilities in C.
However, a C++ library may choose to export some of its functionality to C programs, by declaring them
extern "C". If your C++ library doesn’t do this, you will have to write some wrappers (in C++) that do this.Note that such exported functionality have to conform to C’s limitations. For example, you can’t use non-POD types, function overloading, operator overloading, conversion operators, RTTI, exceptions, templates, etc.