DLL calback functions
-
Hello! I want to write some aplication for example some proprietary TCP client that will connect to some server and receive and send messages. I want this functionality to be encapsulated in DLL library. Some GUI client will load this DLL and call its functions. So far so good. But here is a problem...when TCP client receives some message, I want it to notify GUI client trough some kind of callback function. How do I do that? How do I call a function that is implemented in GUI part from TCP client DLL? I know I did something like that long ago when I was learning about DLL from MSDN article. I can't find this article now. I checked local and internet version of MSDN, but I just can't find it. The title was something like "Introduction to DLL's" or something like that and contained nice pictures of text and data segments mappings. If somebody knows this article please direct me to it. Best regards, Rostfrei
-
Hello! I want to write some aplication for example some proprietary TCP client that will connect to some server and receive and send messages. I want this functionality to be encapsulated in DLL library. Some GUI client will load this DLL and call its functions. So far so good. But here is a problem...when TCP client receives some message, I want it to notify GUI client trough some kind of callback function. How do I do that? How do I call a function that is implemented in GUI part from TCP client DLL? I know I did something like that long ago when I was learning about DLL from MSDN article. I can't find this article now. I checked local and internet version of MSDN, but I just can't find it. The title was something like "Introduction to DLL's" or something like that and contained nice pictures of text and data segments mappings. If somebody knows this article please direct me to it. Best regards, Rostfrei
define a register callback function that take a function pointer as a paramater and export it out of the dll. EX bool RegisterCallback(bool (*FP)(void *,const char *,const char *),void * passin) This defines a function that takes a void pointer and a pointer function that returns a bool and takes a void pointer and two character pointers. I have found that when you define a function that takes a call back you should allways have a void pointer in the callback deffinition and in the called function so you have some way to pass data into the callback.:suss:
a programmer traped in a thugs body