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

Method LoadImage

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

Source from the content-addressed store, hash-verified

890}
891
892bool MAssembly::LoadImage(const String& assemblyPath, const StringView& nativePath)
893{
894 // TODO: Use new hostfxr delegate load_assembly_bytes? (.NET 8+)
895 // Open .Net assembly
896 static void* LoadAssemblyImagePtr = GetStaticMethodPointer(TEXT("LoadAssemblyImage"));
897 _handle = CallStaticMethod<void*, const Char*>(LoadAssemblyImagePtr, assemblyPath.Get());
898 if (_handle == nullptr)
899 {
900 Log::CLRInnerException(TEXT(".NET assembly image is invalid at ") + assemblyPath);
901 return true;
902 }
903 GetAssemblyName(_handle, _name, _fullname);
904 CachedAssemblyHandles.Add(_handle, this);
905
906 // Provide new path of hot-reloaded native library path for managed DllImport
907 if (nativePath.HasChars())
908 {
909 StringAnsi nativeName = _name.EndsWith(".CSharp") ? StringAnsi(_name.Get(), _name.Length() - 7) : StringAnsi(_name);
910 RegisterNativeLibrary(nativeName.Get(), nativePath.Get());
911 }
912#if USE_EDITOR
913 // Register the editor module location for Assembly resolver
914 else
915 {
916 RegisterNativeLibrary(_name.Get(), assemblyPath.Get());
917 }
918#endif
919
920 _hasCachedClasses = false;
921 _assemblyPath = assemblyPath;
922 return false;
923}
924
925bool MAssembly::UnloadImage(bool isReloading)
926{

Callers

nothing calls this directly

Calls 10

GetStaticMethodPointerFunction · 0.85
CLRInnerExceptionClass · 0.85
GetAssemblyNameFunction · 0.85
RegisterNativeLibraryFunction · 0.85
StringAnsiFunction · 0.50
GetMethod · 0.45
AddMethod · 0.45
HasCharsMethod · 0.45
EndsWithMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected