Right, I think RTLD_GLOBAL will be used. I can see that in GetDllHandle defintion below.
the function use RTLD_GLOBAL if unreal 4 module is not.
Also, I don’t have any VTK installed on system global.
VTK libraryies I’ll load are in a path such as MyPlugin/Binaries/ThirdParty/MyVtkThirdpartyLibrary/Linux.
void* FUnixPlatformProcess::GetDllHandle( const TCHAR* Filename )
{
check( Filename );
FString AbsolutePath = FPaths::ConvertRelativePathToFull(Filename);
// first of all open the lib in LOCAL mode (we will eventually move to GLOBAL if required)
int DlOpenMode = RTLD_LAZY;
void *Handle = dlopen( TCHAR_TO_UTF8(*AbsolutePath), DlOpenMode | RTLD_LOCAL );
if (Handle)
{
bool UpgradeToGlobal = false;
// check for the "ue4_module_options" symbol
const char **ue4_module_options = (const char **)dlsym(Handle, "ue4_module_options");
if (ue4_module_options)
{
// split by ','
TArray<FString> Options;
FString UE4ModuleOptions = FString(ANSI_TO_TCHAR(*ue4_module_options));
int32 OptionsNum = UE4ModuleOptions.ParseIntoArray(Options, ANSI_TO_TCHAR(","), true);
for(FString Option : Options)
{
if (Option.Equals(FString(ANSI_TO_TCHAR("linux_global_symbols")), ESearchCase::IgnoreCase))
{
UpgradeToGlobal = true;
}
}
}
else
{
// is it ia ue4 module ? if not, move it to GLOBAL
void *IsUE4Module = dlsym(Handle, "ThisIsAnUnrealEngineModule");
if (!IsUE4Module)
{
IsUE4Module = dlsym(Handle, "InitializeModule");
}
if (!IsUE4Module)
{
UpgradeToGlobal = true;
}
}
if (UpgradeToGlobal)
{
dlclose( Handle );
Handle = dlopen( TCHAR_TO_UTF8(*AbsolutePath), DlOpenMode | RTLD_GLOBAL );
}
}
else if (!FString(Filename).Contains(TEXT("/")))
{
// if not found and the filename did not contain a path we search for it in the global path
Handle = dlopen( TCHAR_TO_UTF8(Filename), DlOpenMode | RTLD_GLOBAL );
}
if (!Handle)
{
UE_LOG(LogCore, Warning, TEXT("dlopen failed: %s"), UTF8_TO_TCHAR(dlerror()) );
}
return Handle;
}