How to share a callback function between two instances of a DLL
To share data between different dll instances, you must compile with
but in this link Microsoft says you can not share pointers or pointer to callback functions.
I have a DLL that acts as a kind of driver reading serial port activity. One function is called from exe program (I have no access to exe file code) to register callback notification function. Then DLL launch a thread and when a condition is done far notification function is called. But as the thread is loaded in other address space, the shared pointer is not valid. I think I have only two alternatives:
1) a way of sharing pointers with its segment base address, but I think this is not allowed. do you know if possible?
2) implement the solution without threads, maybe hooking an event, but I don't know how to hook serial port activity. do you?
any solution to 1 or 2, or any other workaround?