I need to use the function SetEventCallback
in 3rd party dll.
void __stdcall SetEventCallback(void __stdcall callbackFunc(int val))
This function registers callbackFunc
as callback function of some registered events. If an event occurs, callbackFunc
is called and you could know which event is occured through parameter val
.
I want to know how to use the function SetEventCallback
.
I tried using it as follows.
- Import function in dll
extern "C" __declspec(dllimport) void __stdcall SetEventCallback(void __stdcall callbackFunc(int val));
- Define callback function in my application
void __stdcall callbackInApp(int val) {
if(val == 0) {
// Do something with val
}
else {
// Do something with val
}
}
- Call function
SetEventCallback
by passing the function pointer as parameter
int main(void) {
SetEventCallback(callbackInApp);
}
Compilation is success but callbackInApp
is never called.
Please let me know how to fix it.