Dear all
I have a problem with calling C++ function from C. I have two seperate
library, one in C and other in C++. The C project could only compile
with C compiler (gcc) (When I compile with g++, the result is tons of
errors). But now I have to call some function of C++ library from C
library.
Example:
// In C++ library
foo() { /* ... */ }
// In C project
bar() { foo(); }
As far as I know, create header for foo (in C++ library):
// foo.h
extern "C" foo();
// ...
Include foo.h in C library and the problem is: I must compile C library
in gcc and link to C++, but the compiler doesn't work.
Please give me some ideas. Thanks.