My use-case is as follows for a project:
[*]A C header file with a few extern functions declared
[*]A C++ source file with those functions defined
[*]Compile the C++ source into a shared library
In a C source file use the functions declared in C header Связываясь против. Вещи начинают работать
с неназванным Namepsace.#include "stddef.h"
extern void hello(void);
extern void bye(void);
< /code>
cpp_sample.cc:ly>#include
#include "c_sample.h"
extern "C" {
void hello(void) { std::cout
Подробнее здесь: https://stackoverflow.com/questions/795 ... e-question