Afficher un message
Vieux 13/04/2008, 19h39   #1
Angus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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?


  Réponse avec citation
 
Page generated in 0,04933 seconds with 9 queries