Created
August 1, 2013 15:28
-
-
Save hartbit/6132425 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From library | |
typedef void (*Callback) ( int nEvent, const char* sMessage ); | |
void SetCallback( Callback * cbk ); | |
// My code | |
void MyCallback(int nEvent, const char* sMessage) { | |
// .... | |
} | |
SetCallback(MyCallback); | |
// No matching function for call to 'SetCallback' | |
// Candidate function not viable: no known conversion from 'void (int, const char *)' to 'Callback *' (aka 'void (**)(int, const char *)') for 1st argument | |
SetCallback(&MyCallback); | |
// No matching function for call to 'SetCallback' | |
// Candidate function not viable: no known conversion from 'void (*)(int, const char *)' to 'Callback *' (aka 'void (**)(int, const char *)') for 1st argument | |
SetCallback(&&MyCallback); | |
// No matching function for call to 'SetCallback' | |
// Candidate function not viable: cannot convert argument of incomplete type 'void *' to 'Callback *' (aka 'void (**)(int, const char *)') | |
SetCallback((Callback*)MyCallback); | |
SetCallback((Callback*)&MyCallback); | |
SetCallback((Callback*)&&MyCallback); | |
// They all crash when the library tries to call my callback |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment