class MonoManager

Loads Mono script assemblies and manages script objects.

Public

Constructors

MonoManager

MonoManager()

Methods

~MonoManager

~MonoManager() noexcept

LoadMonoLibrary

void LoadMonoLibrary()

Loads the Mono library and sets up the relevant function pointers, if not loaded already.

Must be called before performing any other actions in this class.

UnloadMonoLibrary

void UnloadMonoLibrary()

Unloads the Mono library if loaded.

Caller must make sure to release all Mono objects before calling this method.

LoadAssembly

MonoAssembly &LoadAssembly(const Path &path, const String &name)

Loads a new assembly from the provided path.

path
Absolute path to the assembly .dll.
name
Unique name for the assembly.

UnloadAll

void UnloadAll()

Unloads all assemblies and shuts down the runtime.

Called automatically on module shut-down.

FindClass

MonoClass *FindClass(const MonoTypeIdentifier &typeIdentifier)

Searches all loaded assemblies for the specified class.

FindClass

MonoClass *FindClass(const String &ns, const String &typeName)

Searches all loaded assemblies for the specified class.

FindClass

MonoClass *FindClass(::MonoClass *rawMonoClass)

Searches all loaded assemblies for the specified class.

GetDomain

MonoDomain *GetDomain() const

Returns the main (scripting) Mono domain.

GetAssembly

MonoAssembly *GetAssembly(const String &name) const

Attempts to find a previously loaded assembly with the specified name.

Returns null if assembly cannot be found.

UnloadScriptDomain

void UnloadScriptDomain()

Unloads the active domain (in which all script assemblies are loaded) and destroys any managed objects associated with it.

GetFrameworkAssembliesFolder

Path GetFrameworkAssembliesFolder() const

Returns the absolute path of the folder where Mono framework assemblies are located.

GetMonoEtcFolder

Path GetMonoEtcFolder() const

Returns the absolute path to the Mono /etc folder that is required for initializing Mono.

GetCompilerPath

Path GetCompilerPath() const

Returns the absolute path to the Mono compiler managed executable.

GetMonoExecPath

Path GetMonoExecPath() const

Returns the absolute path to the executable capable of executing managed assemblies.

staticRegisterScriptType

static void RegisterScriptType(ScriptTypeMetaData *metaData, const ScriptTypeMetaData &localMetaData)

Registers a new script type.

This should be done before any assembly loading is done. Upon assembly load these script types will be initialized with necessary information about their managed counterparts.

metaData
Pointer to the meta-data object to initialize, stored statically on the associated TScriptObjectWrapper.
localMetaData
Local copy of the meta-data that will be used to initialize .

staticGetScriptWrapperTypeInformation

static UnorderedMap<String, Vector<RegisteredScriptWrapperTypeInformation>> &GetScriptWrapperTypeInformation()

Returns a list of all registered script wrapper types, by assembly.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

~Module<T>

virtual ~Module<T>() = default

OnStartUp

virtual void OnStartUp()

Override if you want your module to be notified once it has been constructed and started.

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Private

Methods

RefreshScriptTypeMetaDataAndBindings

void RefreshScriptTypeMetaDataAndBindings(MonoAssembly &assembly)

Initializes meta-data and sets up bindings for all script types registered with RegisterScriptType() for the provided assembly.

This should be called after an assembly is loaded or reloaded.

Fields

mAssemblies

UnorderedMap<String, MonoAssembly *> mAssemblies

mScriptDomain

MonoDomain * mScriptDomain

mRootDomain

MonoDomain * mRootDomain

mCorlibAssembly

MonoAssembly * mCorlibAssembly