在一个程序中看到:ACMRegisterReceiveHandler(&GciReceive),不太明白

xhbpla 2006-09-11 11:00:38
/* register a Receive handler, typically the GciReceive function */
if(ACMRegisterReceiveHandler(&GciReceive) == GciNotOk) {
AdPrintErrorMessage();
return GciNotOk;
}

请问在C程序中,注册处理函数句柄,这个功能怎么用?
...全文
95 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lmlmlmnew 2006-09-12
  • 打赏
  • 举报
回复
...既然知道都是函数名字那不说一声,我还以为是句柄呢。
害我出丑 >.<"

如果不是开源的,并且找不到函数实现的话,那就别去想了。
就像让你猜winapi的CreatFile怎么实现的?
老复杂了,这怎么猜啊....

不过我觉得这应该实现的就是把函数挂到某个大的结构体上...
就像T-engine系统里,写驱动的那4个函数open、close等,可以直接赋值也可以通过其他函数把它们挂上一样,就是封装了一下而已....

还是那句话没用过这个什么什么库,所以我胡说 别当真。
xhbpla 2006-09-12
  • 打赏
  • 举报
回复
GciTimeout,GciReceive这些都是函数的名字,
就是不明白,ACMRegisterReceiveHandler(&GciReceive)
这个注册怎么实现的,
lmlmlmnew 2006-09-12
  • 打赏
  • 举报
回复
是注册并将句柄值返回给GciReceive吧

我胡说 别当真。
去看看头文件,应该有函数说明的..这个编码这么规范
xhbpla 2006-09-12
  • 打赏
  • 举报
回复
顶一下这个
xhbpla 2006-09-11
  • 打赏
  • 举报
回复
GciStatus AdInit(const GciAddress* address_vector)
{
int number_of_pcos;
int i;

ACMTime max_timeout;
max_timeout.time_val = 60;
max_timeout.unit = Gcimin;

/* Init the ACM module set the max timeout to one hour and the internal
time scale to micro seconds. */
if(ACMInit(&max_timeout, Gcius) == GciNotOk) {
AdPrintErrorMessage();
return GciNotOk;
}
/* register timeout handler typically the GciTimeout function */
if(ACMRegisterTimeoutHandler(&GciTimeout) == GciNotOk) {
AdPrintErrorMessage();
return GciNotOk;
}

/* register a Receive handler, typically the GciReceive function */
if(ACMRegisterReceiveHandler(&GciReceive) == GciNotOk) {
AdPrintErrorMessage();
return GciNotOk;
}

/* Register default Decode handler */
if(ACMRegisterDefaultDecodeHandler(&ACMDefaultDecoder) == GciNotOk) {
AdPrintErrorMessage();
return GciNotOk;
}


/* Connect all pcos */
number_of_pcos = GciGetNoOfPCOs();
for(i = 0;i < number_of_pcos; i++) {
if(ACMConnect(GciGetPCO(i), &(address_vector[i]), ACMClient, MAX_ENCODING_BUFFER) != GciOk) {
AdPrintErrorMessage();

return GciNotOk;
}
}


return GciOk;
}

这个函数中,注册了许多这类的函数,高手知道是怎么用的吗?
eeyyllehs 2006-09-11
  • 打赏
  • 举报
回复
不清楚,高手解答...
xhbpla 2006-09-11
  • 打赏
  • 举报
回复
是不是注册回调函数啊,还是用异步回调?

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧