Linking a c ++ object to a c object file
2 answers
Take a look at this page: http://dsc.sun.com/solaris/articles/mixing.html
Article Mixing C and C ++ Code in the Same Program
Here you will find all the information you need:
extern "C"
{
#include "header.h"
}
#ifdef __cplusplus
extern "C" {
and so long ...
0
source to share
To start, all functions in a C ++ file that are called from a C file must be marked extern "C"
:
extern "C" int some_function();
This tells the C ++ compiler mangle a name.
To continue, from the C source, you of course cannot use any C ++ functions like classes, namespaces, references and other special functions in C ++.
+3
source to share