// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "MTypes.h" /// /// Main handler for CLR Engine. /// class FLAXENGINE_API MCore { public: /// /// Gets the root domain. /// static MDomain* GetRootDomain(); /// /// Gets the currently active domain. /// static MDomain* GetActiveDomain(); /// /// Creates an new empty domain. /// /// The domain name to create. /// The domain object. static MDomain* CreateDomain(const MString& domainName); /// /// Unloads the domain. /// /// The domain name to remove. static void UnloadDomain(const MString& domainName); public: /// /// Initialize CLR Engine /// /// True if failed, otherwise false. static bool LoadEngine(); /// /// Unload CLR Engine /// static void UnloadEngine(); /// /// Attaches CLR runtime to the current thread. Use it to allow invoking managed runtime from native threads. /// static void AttachThread(); /// /// Exits the managed runtime thread. Clears the thread data and sets its exit code to 0. Use it before ending the native thread that uses AttachThread. /// static void ExitThread(); public: /// /// Helper utilities for C# garbage collector. /// class GC { public: /// /// Forces an immediate garbage collection of all generations. /// static void Collect(); /// /// Forces an immediate garbage collection of the given generation. /// /// The target generation static void Collect(int32 generation); /// /// Suspends the current thread until the thread that is processing the queue of finalizers has emptied that queue. /// static void WaitForPendingFinalizers(); }; };