作者chiwa (我是青蛙,不是王子^_^)
看板LinuxDev
标题[问题] 关於dlsym()这个函数的问题
时间Mon Aug 15 22:40:45 2011
大家好,关於dlsym()这个函数,在网路上有看到一段解释如下
dlsym() will return a NULL result if the symbol wasn't found. If you know
that the symbol could never have the value of NULL or zero, that may be fine,
but there's a potential ambiguity otherwise: if you got a NULL, does that
mean there is no such symbol, or that NULL is the value of the symbol? The
standard solution is to call dlerror() first (to clear any error condition
that may have existed), then call dlsym() to request a symbol, then call
dlerror() again to see if an error occurred.
中间有一段话 (抱歉不会上色,所以另外标出来) :
if you got a NULL, does that mean there is no such symbol,
or that NULL is the value of the symbol?
假设这个symbol是一个函数,会发生symbol成功取得,但是却指向NULL的情况吗?
想像不太出来这到底是什麽状况,能否举个例子让小弟了解
谢谢大家的回答。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.45.230.2
1F:→ WPC001:他是回传SO里头每个变数的值, 如果该值为0,回传当然为0 08/15 23:13
2F:→ WPC001:如果找不到该值, 将会回传0 (NULL) 08/15 23:14
3F:→ chiwa:脑袋打结挺严重的,谢谢你的回答XD 08/17 22:45