Class: RLTK::CG::MemoryBuffer
- Includes:
- BindingClass
- Defined in:
- lib/rltk/cg/memory_buffer.rb
Overview
This class is used by the Module class to dump and load LLVM bitcode.
Instance Attribute Summary
Attributes included from BindingClass
Instance Method Summary collapse
-
#dispose ⇒ void
Frees the resources used by LLVM for this memory buffer.
-
#initialize(overloaded = nil) ⇒ MemoryBuffer
constructor
Create a new memory buffer.
Methods included from BindingClass
Constructor Details
#initialize(overloaded = nil) ⇒ MemoryBuffer
Create a new memory buffer.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rltk/cg/memory_buffer.rb', line 28 def initialize(overloaded = nil) @ptr = case overloaded when FFI::Pointer overloaded else buf_ptr = FFI::MemoryPointer.new(:pointer) msg_ptr = FFI::MemoryPointer.new(:pointer) status = case overloaded when String Bindings.create_memory_buffer_with_contents_of_file(overloaded, buf_ptr, msg_ptr) else Bindings.create_memory_buffer_with_stdin(buf_ptr, msg_ptr) end raise msg_ptr.get_pointer(0).get_string(0) if status != 0 buf_ptr.get_pointer(0) end end |
Instance Method Details
#dispose ⇒ void
This method returns an undefined value.
Frees the resources used by LLVM for this memory buffer.
54 55 56 57 58 59 60 |
# File 'lib/rltk/cg/memory_buffer.rb', line 54 def dispose if @ptr Bindings.dispose_memory_buffer(@ptr) @ptr = nil end end |