From 76ee695a5908490c4cf248ec60f48541faff253f Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sun, 27 Nov 2022 14:45:55 +0200 Subject: [PATCH] Cleanup and minor fixes --- Source/Engine/Main/Windows/main.cpp | 6 +++--- Source/Engine/Scripting/DotNet/CoreCLR.cpp | 17 ----------------- Source/Engine/Scripting/DotNet/CoreCLR.h | 1 - Source/Engine/Scripting/DotNet/MonoApi.cpp | 1 + .../Projects/VisualStudio/VCProjectGenerator.cs | 6 +++--- 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Source/Engine/Main/Windows/main.cpp b/Source/Engine/Main/Windows/main.cpp index 762f82110..1f0e9676e 100644 --- a/Source/Engine/Main/Windows/main.cpp +++ b/Source/Engine/Main/Windows/main.cpp @@ -50,14 +50,14 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmd #endif Platform::PreInit(hInstance); - //__try + __try { return Engine::Main(lpCmdLine); } - /*__except (SehExceptionHandler(GetExceptionInformation())) + __except (SehExceptionHandler(GetExceptionInformation())) { return -1; - }*/ + } } #endif diff --git a/Source/Engine/Scripting/DotNet/CoreCLR.cpp b/Source/Engine/Scripting/DotNet/CoreCLR.cpp index f79a5ba2e..4d7d53052 100644 --- a/Source/Engine/Scripting/DotNet/CoreCLR.cpp +++ b/Source/Engine/Scripting/DotNet/CoreCLR.cpp @@ -109,23 +109,6 @@ bool CoreCLR::InitHostfxr(const String& config_path, const String& library_path_ return true; } -void* CoreCLR::GetFunctionPointerFromDelegate(const String& methodName) -{ - void* fun; - if (cachedFunctions.TryGet(methodName, fun)) - return fun; - - String delegateTypeName = String::Format(TEXT("{0}+{1}Delegate, {2}"), TEXT("FlaxEngine.NativeInterop"), methodName, assemblyName); - - int rc = get_function_pointer(typeName, FLAX_CORECLR_STRING(methodName).Get(), FLAX_CORECLR_STRING(delegateTypeName).Get(), nullptr, nullptr, &fun); - if (rc != 0) - LOG(Fatal, "Failed to get unmanaged function pointer for method {0}: 0x{1:x}", methodName.Get(), (unsigned int)rc); - - cachedFunctions.Add(String(methodName), fun); - - return fun; -} - void* CoreCLR::GetStaticMethodPointer(const String& methodName) { void* fun; diff --git a/Source/Engine/Scripting/DotNet/CoreCLR.h b/Source/Engine/Scripting/DotNet/CoreCLR.h index af55e2f35..2f9c2a753 100644 --- a/Source/Engine/Scripting/DotNet/CoreCLR.h +++ b/Source/Engine/Scripting/DotNet/CoreCLR.h @@ -21,7 +21,6 @@ public: static bool LoadHostfxr(const String& library_path); static bool InitHostfxr(const String& config_path, const String& library_path); - static void* GetFunctionPointerFromDelegate(const String& methodName); static void* GetStaticMethodPointer(const String& methodName); template diff --git a/Source/Engine/Scripting/DotNet/MonoApi.cpp b/Source/Engine/Scripting/DotNet/MonoApi.cpp index 9b46be773..2d290b65e 100644 --- a/Source/Engine/Scripting/DotNet/MonoApi.cpp +++ b/Source/Engine/Scripting/DotNet/MonoApi.cpp @@ -110,6 +110,7 @@ public: ~CoreCLRAssembly() { _classes.ClearDelete(); + assemblyHandles.Remove(_assemblyHandle); } void* GetHandle() diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs index 2a5fe8193..6c8f323a1 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs @@ -176,9 +176,9 @@ namespace Flax.Build.Projects.VisualStudio vcProjectFileContent.AppendLine(" "); vcProjectFileContent.AppendLine(" "); vcProjectFileContent.AppendLine(" "); - vcProjectFileContent.AppendLine(string.Format(" dotnet {0} -build", cmdLine)); - vcProjectFileContent.AppendLine(string.Format(" dotnet {0} -rebuild", cmdLine)); - vcProjectFileContent.AppendLine(string.Format(" dotnet {0} -clean", cmdLine)); + vcProjectFileContent.AppendLine(string.Format(" {0} -build", cmdLine)); + vcProjectFileContent.AppendLine(string.Format(" {0} -rebuild", cmdLine)); + vcProjectFileContent.AppendLine(string.Format(" {0} -clean", cmdLine)); vcProjectFileContent.AppendLine(string.Format(" {0}", outputTargetFilePath)); if (preprocessorDefinitions.Count != 0)