John Lam 1997 — 2026

Third drop of RbDynamicMethod

Here’s another drop of RbDynamicMethod. New to this release is a custom implementation of Type.GetMethod that correctly finds overloaded generic methods. The .NET implementation of this method does not support resolving generic methods, so I wound up rolling my own. If you’re interested in its implementation you should check out FindGenericMethodTemplate in the sources.

This is what using RbDynamicMethod to call a generic method looks like:

create_ruby_module_function(RbDynamicMethod, 'call_generic_min_method') do
  include   'RbDynamicMethodTests'
  ldc_i4_3
  ldc_i4_2
  call      'static GenericMethodTests::Min<Int32>(Int32, Int32)'
  call      'static Marshal::ToRubyNumber(Int32)'
  ret
end
assert_equal 2, call_generic_min_method

This should be the last drop of this library for the next little while since I think it’s good enough to begin building my new Ruby to CLR bridge on top of it.

2 archived reader comments

Justin (2005-12-14)

I have to admit I’m not as able to follow the IL side of this project, but I’m really excited about the possibility of driving .NET from Ruby. I’ve done a lot of .NET programming (windows forms) and ever since I started using Ruby I’ve wanted to drive them from Ruby. I hope your project finally provides that ability!

John Lam (2005-12-15)

Yes - Windows forms programming is a supported scenario in the bridge. I’ve got some samples written for my older bridge that drive both Windows Forms as well as Avalon from Ruby.