How do I create a function in my library for passing user callback function
Hello
I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:
int (*callbackfunction)(const char*);
In my libary do I create a function where user passes this callback
function? How would I define the function?
I tried this
callbackfunction clientfunction;
void SpecifyCallbackfunction(cbFunction cbFn)
{
clientfunction = cbFn;
}
Then called like this:
clientfunction(sz); // sz is a C-string.
But program crashes with access violation when attempt to call
clientfunction
What am I doing wrong?
|