I gave you a link to the page with the answer already:

http://www.ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html

Click on that link. Read it all. Look where they call 
rb_define_method(), and do the same yourself.

-- 
Posted via http://www.ruby-forum.com/.