class RLTK::CG::Context

Bindings for LLVM contexts.

Constants

CLASS_FINALIZER

The Proc object called by the garbage collector to free resources used by LLVM.

Public Class Methods

global() click to toggle source

@return [Context] A global context.

# File lib/rltk/cg/context.rb, line 31
def self.global
        self.new(Bindings.get_global_context())
end
new(ptr = nil) click to toggle source

@param [FFI::Pointer, nil] ptr Pointer representing a context. If nil, a new context is created.

# File lib/rltk/cg/context.rb, line 40
def initialize(ptr = nil)
        @ptr = ptr || Bindings.context_create()

        # Define a finalizer to free the memory used by LLVM for this
        # context.
        ObjectSpace.define_finalizer(self, CLASS_FINALIZER)
end