George Ogata wrote: >Your compiler should probably have given you a good number of >warnings/errors. `result' is undeclared, for instance. Did you >actually compile this code? > >This worked for me: > > int regExMatch(int pos, char *pattern, char *text) > { > VALUE re, str, result; > re = rb_reg_new(pattern, strlen(pattern), 1); > str = rb_str_new2(text); > result = rb_funcall(re, rb_intern("match"), 2, str, INT2NUM(pos)); > // re will be a Ruby nil if no match is found. > return RTEST(result); > } > > > Yes, it compiled -- I didn't include all of the declarations for brevity's sake. And you were right about the ruby_init() call -- that was the (very newbie) problem. much thanks, Dave