Try the following and see if it does what you are attempting.
(1) Create a Win32 Console project.
(2) Add a C source code file to the project, with this code:
/* C_Code.c */
#include <stdio.h>
extern float cppfunc();
void cfunc()
{
float val = cppfunc();
printf("%f\n", val);
}
(3) Add a C++ source code file to the project, with this code:
// CPP_Code.cpp
#include <iostream>
extern "C" void cfunc();
extern "C" float cppfunc()
{
return 1.0f;
}
int main()
{
std::cout << cppfunc() << "\n";
cfunc();
}
(4) Build and Run.
Expected output:
1
1.000000
- Wayne