Module: Mcpp
- Extended by:
- FFI::Library
- Defined in:
- lib/mcpp.rb,
lib/mcpp/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Class Method Details
.preprocess(*args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mcpp.rb', line 16 def self.preprocess(*args) strptrs = [] strptrs << FFI::MemoryPointer.from_string("Ruby!") # placeholder for argv[0] args.each do |a| strptrs << FFI::MemoryPointer.from_string(a.to_s) end strptrs << nil # Now load all the pointers into a native memory block argv = FFI::MemoryPointer.new(:pointer, strptrs.length) strptrs.each_with_index do |p, i| argv[i].put_pointer(0, p) end mcpp_lib_main(strptrs.length - 1, argv) end |