_some prog, needs aot for corlib
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
#include <mono/metadata/mono-gc.h>
|
||||
#include <mono/metadata/mono-private-unstable.h>
|
||||
typedef char char_t;
|
||||
#define DOTNET_HOST_MONO_DEBUG 0
|
||||
#define DOTNET_HOST_MONO_DEBUG 1
|
||||
#ifdef USE_MONO_AOT_MODULE
|
||||
void* MonoAotModuleHandle = nullptr;
|
||||
#endif
|
||||
@@ -270,6 +270,36 @@ struct NativePropertyDefinitions
|
||||
MMethodAttributes setterAttributes;
|
||||
};
|
||||
|
||||
#if PLATFORM_WEB
|
||||
|
||||
extern "C"
|
||||
{
|
||||
DLLEXPORT void schedule_background_exec()
|
||||
{
|
||||
}
|
||||
|
||||
DLLEXPORT int mono_wasm_process_current_pid()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
DLLEXPORT void mono_wasm_schedule_timer(int shortestDueTimeMs)
|
||||
{
|
||||
}
|
||||
|
||||
DLLEXPORT int mono_jiterp_parse_option(const char* option)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
DLLEXPORT int mono_wasm_browser_entropy(uint8_t* buffer, int32_t bufferLength)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
MDomain* MCore::CreateDomain(const StringAnsi& domainName)
|
||||
{
|
||||
return nullptr;
|
||||
@@ -281,6 +311,7 @@ void MCore::UnloadDomain(const StringAnsi& domainName)
|
||||
|
||||
bool MCore::LoadEngine()
|
||||
{
|
||||
LOG(Info, "DotNet MCore::LoadEngine");
|
||||
PROFILE_CPU();
|
||||
PROFILE_MEM(ScriptingCSharp);
|
||||
|
||||
@@ -1757,6 +1788,7 @@ hostfxr_run_app_fn hostfxr_run_app;
|
||||
|
||||
bool InitHostfxr()
|
||||
{
|
||||
LOG(Info, "InitHostfxr");
|
||||
const ::String csharpLibraryPath = Globals::BinariesFolder / TEXT("FlaxEngine.CSharp.dll");
|
||||
const ::String csharpRuntimeConfigPath = Globals::BinariesFolder / TEXT("FlaxEngine.CSharp.runtimeconfig.json");
|
||||
if (!FileSystem::FileExists(csharpLibraryPath))
|
||||
@@ -2187,6 +2219,7 @@ bool MonoAotPreloadTask::Run()
|
||||
|
||||
bool InitHostfxr()
|
||||
{
|
||||
LOG(Info, "InitHostfxr2");
|
||||
#if DOTNET_HOST_MONO_DEBUG
|
||||
// Enable detailed Mono logging
|
||||
Platform::SetEnvironmentVariable(TEXT("MONO_LOG_LEVEL"), TEXT("debug"));
|
||||
@@ -2205,6 +2238,7 @@ bool InitHostfxr()
|
||||
|
||||
#if defined(USE_MONO_AOT_MODE)
|
||||
// Enable AOT mode (per-platform)
|
||||
LOG(Info, "InitHostfxr mono_jit_set_aot_mode");
|
||||
mono_jit_set_aot_mode(USE_MONO_AOT_MODE);
|
||||
#endif
|
||||
|
||||
@@ -2215,6 +2249,7 @@ bool InitHostfxr()
|
||||
#endif
|
||||
|
||||
#ifdef USE_MONO_AOT_MODULE
|
||||
LOG(Info, "InitHostfxr USE_MONO_AOT_MODULE");
|
||||
// Wait for AOT module preloading
|
||||
while (Platform::AtomicRead(&MonoAotPreloadServiceInstance.Ready) == 0)
|
||||
Platform::Yield();
|
||||
@@ -2246,6 +2281,7 @@ bool InitHostfxr()
|
||||
#endif
|
||||
|
||||
// Setup debugger
|
||||
LOG(Info, "InitHostfxr2 setup debugger");
|
||||
{
|
||||
int32 debuggerLogLevel = 0;
|
||||
if (CommandLine::Options.MonoLog.IsTrue() || DOTNET_HOST_MONO_DEBUG)
|
||||
@@ -2292,6 +2328,7 @@ bool InitHostfxr()
|
||||
#endif
|
||||
}
|
||||
|
||||
LOG(Info, "InitHostfxr2 set log handler");
|
||||
// Connect to mono engine callback system
|
||||
mono_trace_set_log_handler(OnLogCallback, nullptr);
|
||||
mono_trace_set_print_handler(OnPrintCallback);
|
||||
@@ -2325,15 +2362,18 @@ bool InitHostfxr()
|
||||
#else
|
||||
const char* monoVersion = ""; // ignored
|
||||
#endif
|
||||
LOG(Info, "InitHostfxr2 mono_jit_init_version");
|
||||
MonoDomainHandle = mono_jit_init_version("Flax", monoVersion);
|
||||
if (!MonoDomainHandle)
|
||||
{
|
||||
LOG(Fatal, "Failed to initialize Mono.");
|
||||
return true;
|
||||
}
|
||||
LOG(Info, "InitHostfxr2 mono_gc_init_finalizer_thread");
|
||||
mono_gc_init_finalizer_thread();
|
||||
|
||||
// Log info
|
||||
LOG(Info, "InitHostfxr2 mono_get_runtime_build_info");
|
||||
char* buildInfo = mono_get_runtime_build_info();
|
||||
LOG(Info, "Mono runtime version: {0}", String(buildInfo));
|
||||
mono_free(buildInfo);
|
||||
|
||||
Reference in New Issue
Block a user