1
我在可可应用程序中动态库存在问题。动态库不可卸载在可可应用程序中
上的一个按钮动作,我打开一个dylib,RESOLV一个功能它并执行它,如下所示:
void* handle = dlopen("blah.dylib", RTLD_LAZY);
if (!handle)
{
NSLog(@"dlopen() failure : %s", dlerror());
return;
}
function_to_resolv p = (function_to_resolv)dlsym(handle, "function_to_resolv");
function_to_resolv();
if (dlclose(handle) != 0)
NSLog(@"FAIL");
所有工作正常,但该库是永远不会从二进制卸载。
我用下面的代码验证它:
const uint32_t s = _dyld_image_count();
for (uint32_t i = 0; i < s; i++)
{
const char* str = _dyld_get_image_name(i);
NSLog(@"%s", str);
}
为什么会是什么原因呢?
也许http://stackoverflow.com/questions/8793099/unload-dynamic-library-needs-two-dlclose-calls提供了答案。 – Matthias 2012-03-01 16:06:24
天哪,我错过了。谢谢,恢复正是这个问题,但可悲的是没有解决方案atm :( – Nyx0uf 2012-03-01 21:52:41