[Gambas-devel] Gambas Interface

Daniel daniel.campos at ...103...
Wed Apr 28 18:39:40 CEST 2004


> >
> 
> Why don't you use the fourth parameter of GB.Watch() ? It is passed to the 
> callback.


Sorry, but I don't understand. Let's see for example UdpSocket class.
The only point in the CUdpSocket.c code in which I assign a call-back is
this:

-----------------------------------------------------
void CUdpSocket_AssignCallBack(long t_obj,int t_sock)
{
	...
	GB.Watch (t_sock , GB_WATCH_WRITE,(void*)CUdpSocket_CallBack,0);
	...

}
-----------------------------------------------------

The fourth parameter is zero, and in the callback function :

-------------------------------------
void CUdpSocket_CallBack(long lParam)
{
	....
}
-------------------------------------

I receive the socket descriptor in lParam.

Now I've changed the fourth parameter:

---------------------------------------
void CUdpSocket_AssignCallBack(long t_obj,int t_sock)
{
  ...
  GB.Watch (t_sock , GB_WATCH_WRITE,(void*)CUdpSocket_CallBack,t_obj);
  ...

}
---------------------------------------

(t_obj is a pointer to a CUDPSOCKET structure)

And it still works! I receive the socket descriptor in lParam!

I'm puzzle... What I'm doing wrong?

Regards,

Daniel Campos







More information about the Devel mailing list