s*******8 发帖数: 12734 | 1 【 以下文字转载自 Programming 讨论区 】
发信人: story9988 (小小故事人), 信区: Programming
标 题: 新手,一个C 库的问题
发信站: BBS 未名空间站 (Wed Apr 18 09:30:38 2012, 美东)
我用了第三方的dll
这个硬件相关的dll是一些api, 其中有一个 third_party_allocate()
third_party_free()
这个dll静态连接了一个C library
所以这个 third_party_allocate(), third_party_free()就是wrap了
c的malloc(), free()
借口,参数类型,完全一样,当然,third_party_xxx()调用的是他静态连接里面的
c library.
我在程序里用系统的C 库里面的 free(p)
来释放 third_party_malloc()返回的p
结果异常被throw了,
为什么呢?
这个free()和他们本身的是一样的。
唯一差别一个是静态连接到她们自己的dll里面的
请高手指点 |
p*****2 发帖数: 21240 | 2
debug一下,看看third_party_allocate返回的地址周围有没有什么特殊情况。但是我
不明白为什么不用他们的函数free。
【在 s*******8 的大作中提到】 : 【 以下文字转载自 Programming 讨论区 】 : 发信人: story9988 (小小故事人), 信区: Programming : 标 题: 新手,一个C 库的问题 : 发信站: BBS 未名空间站 (Wed Apr 18 09:30:38 2012, 美东) : 我用了第三方的dll : 这个硬件相关的dll是一些api, 其中有一个 third_party_allocate() : third_party_free() : 这个dll静态连接了一个C library : 所以这个 third_party_allocate(), third_party_free()就是wrap了 : c的malloc(), free()
|
s*******8 发帖数: 12734 | 3 thanks for reply
actually it is not my code ...
that's why...
【在 p*****2 的大作中提到】 : : debug一下,看看third_party_allocate返回的地址周围有没有什么特殊情况。但是我 : 不明白为什么不用他们的函数free。
|
r*****k 发帖数: 1281 | 4 why not using third_party_free()? |
s*******8 发帖数: 12734 | 5 not my code.
the reason is that the original author thinks "third_party_free"
causes problems
【在 r*****k 的大作中提到】 : why not using third_party_free()?
|