Skip to content

Instantly share code, notes, and snippets.

@benolee
Created January 14, 2013 20:11
Show Gist options
  • Select an option

  • Save benolee/4532938 to your computer and use it in GitHub Desktop.

Select an option

Save benolee/4532938 to your computer and use it in GitHub Desktop.
playing with Fiddle::Function
>> require 'fiddle'
=> true
>> func = Fiddle::Function.new(DL::Handle::DEFAULT['rb_eval_string'], [DL::TYPE_VOIDP], DL::TYPE_VOIDP)
=> #<Fiddle::Function:0x000001010404c8>
>> func.call("1 + 1")
=> #<DL::CPtr:0x00000101821930 ptr=0x00000000000005 size=0 free=0x00000000000000>
>> func.call("1 + 1").to_value
=> 2
>> func.call("puts 'hello'").to_value
hello
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment