/trunk/Examples/ruby/funcptr/runme.rb
Ruby | 21 lines | 13 code | 6 blank | 2 comment | 0 complexity | 5d703f65ec4d01b853712bca3e09ec90 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- # file: runme.rb
- require 'example'
- a = 37
- b = 42
- # Now call our C function with a bunch of callbacks
- print "Trying some C callback functions\n"
- print " a = #{a}\n"
- print " b = #{b}\n"
- print " ADD(a,b) = ", Example::do_op(a,b,Example::ADD),"\n"
- print " SUB(a,b) = ", Example::do_op(a,b,Example::SUB),"\n"
- print " MUL(a,b) = ", Example::do_op(a,b,Example::MUL),"\n"
- print "Here is what the C callback function objects look like in Ruby\n"
- print " ADD = #{Example::ADD}\n"
- print " SUB = #{Example::SUB}\n"
- print " MUL = #{Example::MUL}\n"