Skip to content

Instantly share code, notes, and snippets.

@fstrozzi
Created April 27, 2011 07:22
Show Gist options
  • Save fstrozzi/943843 to your computer and use it in GitHub Desktop.
Save fstrozzi/943843 to your computer and use it in GitHub Desktop.
# Internal method to build argument list for BWA C functions
# @note this method should not be called directly
def self.build_args_for_BWA(args)
cmd_args = args.map do |arg|
FFI::MemoryPointer.from_string(arg.to_s) # convert every parameters into a string and then into a memory pointer
end
exec_args = FFI::MemoryPointer.new(:pointer, cmd_args.length) # creating a pointer to an array of pointers
cmd_args.each_with_index do |arg, i|
exec_args[i].put_pointer(0, arg) # filling in the array of pointers
end
return exec_args
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment