T
terrencel
I was told to look at some old C code that was ported to C++.
One of the file is like:
=========================================
CPPClass* someCPPVar = NULL;
extern "C"
{
void init()
{
someCPPVar = new CPPClass();
}
void somefunction()
{
bool (*callback)(...);
callback = NULL;
someCPPVar->someMethod((void (**)(...))&callback);
}
}
=========================================
My questions:
1. Can I remove the 'extern "C"' block as I have the source code?
I can just use a C++ compiler to compile it. Right?
2. Currently, I got compile error as follows: (Sun Forte Developer 7 C++ 5.4)
Error: Formal argument 1 of type void(*)(...)* in call to
CPPClass::someMethod(void(*)(...)*) is being passed extern
"C" void(*)(...)*.
Does anyone know how to resolve this problem?
Thanks in advance
One of the file is like:
=========================================
CPPClass* someCPPVar = NULL;
extern "C"
{
void init()
{
someCPPVar = new CPPClass();
}
void somefunction()
{
bool (*callback)(...);
callback = NULL;
someCPPVar->someMethod((void (**)(...))&callback);
}
}
=========================================
My questions:
1. Can I remove the 'extern "C"' block as I have the source code?
I can just use a C++ compiler to compile it. Right?
2. Currently, I got compile error as follows: (Sun Forte Developer 7 C++ 5.4)
Error: Formal argument 1 of type void(*)(...)* in call to
CPPClass::someMethod(void(*)(...)*) is being passed extern
"C" void(*)(...)*.
Does anyone know how to resolve this problem?
Thanks in advance