I have written the following code:

#include <ruby.h>

VALUE do_something(VALUE str)
{
     printf("executing function: do_something\n");
     char *s = RSTRING(str)->ptr;
     printf("argument: %s\n", s);

     return rb_tainted_str_new2("OK");
}

int main(int argc, char* argv[])
{
     //Way 1
     ruby_init();

     //Here i register my global function
     rb_define_global_function("do_something", (VALUE
(*)(...))&do_something, 1);
     rb_eval_string("do_something \"hi!\"\n");
     return 0;
}

The command gets evaluated ok but something seems to be wrong with the
argument i get in the
do_something function. If i use the TYPE(str) macro i get as a result 2
which equals T_OBJECT
instead of T_STRING as i expected. What am i doing wrong?

Thank you in advance
Kostas