From: Harold Hausman Date: 2007-02-17T23:46:39+09:00 Subject: Re: Using Ruby as an extension language On 2/16/07, Farrel Lifson wrote: > > Programming Ruby (Pragmatic Programmers) has a nice section on > embedding Ruby. Also have a look at README.EXT in the Ruby source > code. > Okay, I've read both these, and things are going nicely. rb_eval_string seems much happier than ruby_options/ruby_run... (: 2 questions: This seems like a nice replacement for luaL_dofile: rb_eval_string( "$: << Dir.getwd" ); rb_eval_string( "require '.\\main.rb'" ); 1. This appears to be working nicely, is there anything horribly wrong with it? And my other question comes from when I try to expose a new method to the running Ruby. Here are some snippets of my code: VALUE rb_myprint( VALUE inSelf, VALUE inString ) { // snip... but do stuff here, etc.... return Qnil; } and then later: rb_define_global_function( "myprint", rb_myprint, 1 ); 2. When I try to compile this, I get the following error: Error 2 error C2664: 'rb_define_global_function' : cannot convert parameter 2 from 'VALUE (__cdecl *)(VALUE,VALUE)' to 'VALUE (__cdecl *)(...)' d:\code\littlecoder\littlecoder.cpp 68 I'm not familiar with the 'old-school' "C" "..." syntax, so I'm kind of stuck here. If someone can fill me in on how to properly define/declare these function pointers so I can pass them in that'd be sweet. Thanks again, -Harold