Table of Contents

Constructor Context

Namespace
Ubiquity.NET.Llvm
Assembly
Ubiquity.NET.Llvm.dll

Context()

Initializes a new instance of the Context class.

public Context()

Remarks

This creates an underlying native LLVM context handle and wraps it in this instance. Callers should call Dispose() to release the native allocation as early as possible. Anything owned by this context is destroyed by the call to Dispose(), thus any references to those items are invalid once the context is destroyed. This is particularly relevant for any IDisposable items (like a Module). If those are left to linger at the mercy of the garbage collector/finalization then problems can happen. Since .NET uses a non-deterministic finalization design there is no guarantee that an element is finalized BEFORE the container that owns it. Thus if the finalizer destroys the container and then attempts to destroy the element - BOOM access violation and app crash occur. The location of such a crash is well after the problem occurred. This is a VERY difficult situation to debug. (Though, in a debug build of this library, the call stack of the creator of any owned handle is captured to make it easier to find the cause of such things.)

See Also
GlobalHandleBase