Is this legal to do? I want to export a C function, but internally that function will use a C++ class.
extern "C" BOOL /*BOOL==int*/ Func()
{
return someclass::getinstance()->Func(); // this is just bool tho
}
This is perfectly legitimate. The purpose of extern "C" is to prevent Func() from getting its name mangled (decorated with type information) so that a C module can link to it using its plain name. C++ mangles names so that functions with the same name but different parameter lists can be resolved (function overloading).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With