applied a hint given from Ingo during BeGeistert:
* use dlopen() instead of load_add_on() when loading liblocale.so from libbe.so, as otherwise the library could end up in the image more than once. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36357 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1276d52122
commit
71609f7e46
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "LocaleBackend.h"
|
#include "LocaleBackend.h"
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -25,13 +26,14 @@ static pthread_once_t sBackendInitOnce = PTHREAD_ONCE_INIT;
|
|||||||
static void
|
static void
|
||||||
LoadBackend()
|
LoadBackend()
|
||||||
{
|
{
|
||||||
image_id libLocaleAddonID = load_add_on("/system/lib/liblocale.so");
|
void* imageHandle = dlopen("liblocale.so", RTLD_LAZY);
|
||||||
|
if (imageHandle == NULL)
|
||||||
if (libLocaleAddonID < 0)
|
|
||||||
return;
|
return;
|
||||||
LocaleBackend* (*createInstanceFunc)();
|
|
||||||
if (get_image_symbol(libLocaleAddonID, "CreateLocaleBackendInstance",
|
typedef LocaleBackend* (*symbolType)();
|
||||||
B_SYMBOL_TYPE_TEXT, (void**)&createInstanceFunc) != B_OK)
|
symbolType createInstanceFunc = (symbolType)dlsym(imageHandle,
|
||||||
|
"CreateLocaleBackendInstance");
|
||||||
|
if (createInstanceFunc == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gLocaleBackend = createInstanceFunc();
|
gLocaleBackend = createInstanceFunc();
|
||||||
|
Loading…
Reference in New Issue
Block a user