2012-03-01 5 views
1

Cocoaアプリケーションのダイナミックライブラリに問題があります。Cocoaアプリケーションでダイナミックライブラリをアンロードできない

ボタンアクションで

、私は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); 
} 

+1

おそらくhttp://stackoverflow.com/questions/8793099/unload-dynamic-library-needs-two-dlclose-callsが答えを提供します。 – Matthias

+0

ああ、私はそれを逃した。問題を再開してくれてありがとう、ありがとうございますが、残念ながら解決策はありません。 – Nyx0uf

答えて

0

マティアス・ヴェルナーは、リンクされたスレッドが有益な情報が含まれています:unload dynamic library needs two dlclose() calls?

は、この現象は、OBJの-Cランタイムのものであり、現時点でやるべきものは何もありません。

関連する問題