You need an adapter consisting of a C ++ translation block and a header that can be used from both C and C ++, for example (use more convenient names):
adapter.h:
#ifndef ADAPTER_H #define ADAPTER_H #endif #ifdef __cplusplus extern "C" { #endif void adapter_Foo(int arg1, int *arg2);
adapter.cpp:
#include "adapter.h"
You can compile this adapter into a separate DLL or you can use it as part of your main program. In your C code, simply #include "adapter.h" and call adapter_Foo() instead of Foo() .
source share