MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / OnMonoDlFallbackLoad

Function OnMonoDlFallbackLoad

Source/Engine/Scripting/Runtime/DotNet.cpp:2145–2176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2143#include <dlfcn.h>
2144
2145static void* OnMonoDlFallbackLoad(const char* name, int flags, char** err, void* user_data)
2146{
2147 PROFILE_CPU();
2148 ZoneText(name, StringUtils::Length(name));
2149 const String fileName = StringUtils::GetFileName(String(name));
2150#if DOTNET_HOST_MONO_DEBUG
2151 LOG(Info, "Loading dynamic library {0}", fileName);
2152#endif
2153 int dlFlags = 0;
2154 if (flags & MONO_DL_GLOBAL && !(flags & MONO_DL_LOCAL))
2155 dlFlags |= RTLD_GLOBAL;
2156 else
2157 dlFlags |= RTLD_LOCAL;
2158 if (flags & MONO_DL_LAZY)
2159 dlFlags |= RTLD_LAZY;
2160 else
2161 dlFlags |= RTLD_NOW;
2162 void* result = dlopen(name, dlFlags);
2163 if (!result)
2164 {
2165 // Try Frameworks location on iOS
2166 String path = Globals::ProjectFolder / TEXT("Frameworks") / fileName;
2167 if (!path.EndsWith(TEXT(".dylib")))
2168 path += TEXT(".dylib");
2169 result = dlopen(StringAsANSI<>(*path).Get(), dlFlags);
2170 if (!result)
2171 {
2172 LOG(Error, "Failed to load dynamic libary {0}", String(name));
2173 }
2174 }
2175 return result;
2176}
2177
2178static void* OnMonoDlFallbackSymbol(void* handle, const char* name, char** err, void* user_data)
2179{

Callers

nothing calls this directly

Calls 4

LengthFunction · 0.50
StringFunction · 0.50
EndsWithMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected