Class: RLTK::CG::Context
- Includes:
- BindingClass
- Defined in:
- lib/rltk/cg/context.rb
Overview
Bindings for LLVM contexts.
Constant Summary collapse
- CLASS_FINALIZER =
The Proc object called by the garbage collector to free resources used by LLVM.
Proc.new { |id| Bindings.context_dispose(ptr) if ptr = ObjectSpace._id2ref(id).ptr }
Instance Attribute Summary
Attributes included from BindingClass
Class Method Summary collapse
-
.global ⇒ Context
A global context.
Instance Method Summary collapse
-
#initialize(ptr = nil) ⇒ Context
constructor
A new instance of Context.
Methods included from BindingClass
Constructor Details
#initialize(ptr = nil) ⇒ Context
Returns a new instance of Context.
40 41 42 43 44 45 46 |
# 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 |
Class Method Details
.global ⇒ Context
Returns A global context.
31 32 33 |
# File 'lib/rltk/cg/context.rb', line 31 def self.global self.new(Bindings.get_global_context()) end |