This section documents some of the internal APIs used inside Mono that developers extending or altering Mono might want to use.
The routines in this section are used to cope with errors during metadata loading. Errors in metadata handling can happen for many reason, and these include (this is not an exhaustive list).
The mono_loader_set_* routines are invoked during metadata loading to flag that an error has happened. The class loading errros are flagged in a per-thread basis.
In various spots in the runtime the mono_loader_get_last_error routine is called to check if there was a problem, and then errors are propagated upwards on the stack until we reach a point where an exception can be raised and no runtime locks are held.
The mono_loader_error_prepare_exception takes a MonoLoaderError structure (the value returned from mono_loader_get_last_error), turns that into an exception and clears the error condition from the current thread.
The locking functions here are used by code in class.c and metadata.c to lock access to the shared hashtables inside the MonoImage.
The internal interface of the Mono GC is the interface used between the runtime engine and the garbage collector.