cegui 动态链接库调用路径

//----------------------------------------------------------------------------//
static String getModuleDirEnvVar()
{
if (const char* envModuleDir = getenv(MODULE_DIR_VAR_NAME))
return String(envModuleDir);

return String();
}

 

//----------------------------------------------------------------------------//
static DYNLIB_HANDLE DynLibLoad(const String& name)
{
    DYNLIB_HANDLE handle = 0;

    // prefer whatever location is set in CEGUI_MODULE_DIR environment var
    const String envModuleDir(getModuleDirEnvVar());

    if (!envModuleDir.empty())
        handle = DYNLIB_LOAD(envModuleDir + '/' + name);

    #ifdef __APPLE__
    if (!handle)
        // on apple, look in the app bundle frameworks directory
        handle = DYNLIB_LOAD("@executable_path/../Frameworks/" + name);
    #endif

    if (!handle)
        // try loading without any explicit location (i.e. use OS search path)
        handle = DYNLIB_LOAD(name);

    // finally, try using the compiled-in module directory
    #if defined(CEGUI_MODULE_DIR)
    if (!handle)
        handle = DYNLIB_LOAD(CEGUI_MODULE_DIR + name);
    #endif

    return handle;
}

 

posted on 2022-11-03 18:15  zxddesk  阅读(39)  评论(0)    收藏  举报

导航