Hi;
I have a C static library with,
A callback definition:
typedef void (*HandleEvents) (enum events eventID, int msgSize, char *msg);
A function in the library:
int init(HandleEvents _handleEvents)
And another C++ GUI developed in VS. which links this static lib and calls init function of the lib giving a function pointer.
init(&CGateway::handleEventsFunc);
where CGateway::handleEventsFunc is a static class function.
In a thread in the static lib calls this callback of the C++ GUI. But I got errors of heap corruption.
In sum, there are 2 threads, one in static library and one in Main GUI app. Static library calls Main GUI's class function.
So what is the correct way of calling callback function in a thread?