Events inside a dll


2005-03-31 03:51:38 PM
cppbuilder97
I have develop a code for monitoring a device connected to de serial port.
My code is a TThread that monitors the device and comunicate the main thread
any change of its status throught de metod Synchronize. Thats is working ok.
Now I want to put my TThread inside a dll. And i define a kind of a callbak
function
typedef void _stdcall t_event (int , int , char * );
t_event *f_callback=NULL;
void _stdcall evento (int l, int e , char *t)
{
if (f_callback!=NULL)
f_callback(l,e,t);
}
It works . The code for getting the event in the main application that uses
de dll is called.
But when that code finished and shoud be return to the synchronize in my
TThread the whole application closes without any message of exception.
What's wrong?
Which is the best way for using events inside dlls to the applications that
uses that dlls?