Introduce anonymous namespace

The anonymous namespace is introduced to
handle cases when linker can not find the
caller. This usually happens when caller
code was not loaded by dynamic linker;
for example mono-generated code.

Bug: http://b/25844435
Bug: http://b/22548808
Change-Id: I9e5b1d23c1c75bc78548d68e79216a6a943a33cf
This commit is contained in:
Dmitriy Ivanov
2015-11-23 11:26:35 -08:00
parent a7fc7f9909
commit 1ffec1cc4d
15 changed files with 164 additions and 47 deletions

View File

@@ -40,10 +40,12 @@ extern "C" const char* ns_get_dlopened_string() {
return nullptr;
}
const char* result = *static_cast<const char**>(dlsym(handle, "g_private_dlopened_string"));
if (result != nullptr) {
const char** result = static_cast<const char**>(dlsym(handle, "g_private_dlopened_string"));
if (result == nullptr) {
return nullptr;
} else {
g_dlopened = true;
}
return result;
return *result;
}