F
Franz
Hello
I have some C code where I can register function pointers for
callback:
[c]
/* reaction.h */
...
typedef void (*FP) (int,int);
addReaction(FP);
...
Can I pass a "c++" function (not a member function) from c++ code to
'addRection()' ?
[c++]
/* x.hpp */
...
void xFunc(int a, int b);
...
/* x.cpp */
#include "x.hpp"
#include "reaction.h"
...
ini()
{
addReaction(&xFunc);
}
Or do I have to declare that function as extern "C":
[c++]
/* x.hpp */
...
extern "C" void xFunc(int a, int b);
...
Thanks
Franz
I have some C code where I can register function pointers for
callback:
[c]
/* reaction.h */
...
typedef void (*FP) (int,int);
addReaction(FP);
...
Can I pass a "c++" function (not a member function) from c++ code to
'addRection()' ?
[c++]
/* x.hpp */
...
void xFunc(int a, int b);
...
/* x.cpp */
#include "x.hpp"
#include "reaction.h"
...
ini()
{
addReaction(&xFunc);
}
Or do I have to declare that function as extern "C":
[c++]
/* x.hpp */
...
extern "C" void xFunc(int a, int b);
...
Thanks
Franz