Suppose you have a .cpp file (that is, compiled using a C++ compiler like MSVC). In that file, you define a struct in the following way:
struct Pixel
{
float x, y;
};
In the same file, you have a line of code that will call a C function, that requires a C struct equal to Pixel. If you write:
Pixel my_pixel
// set my_pixel to something
c_func(&my_pixel);
will it work? I mean, the C++ compiler will create the object my_pixel, but it will pass it to a function that is compiled as C code (i have only a .lib of that library).
If the header file is correct, it will work, assuming the C compiler and the C++ compiler use compatible calling conventions. Make sure the header file has an appropriate
extern "C"block that contains the function definition.