From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2001-04-05T03:40:04+09:00 Subject: [ruby-talk:13497] Re: C extentions: having trouble with STR2CSTR In article , Lyle Johnson wrote: >> static VALUE m_RunWithTimeout(VALUE rStr) >> { >> char* cStr; >> cStr = STR2CSTR(rStr); >> printf("%s",cStr); >> } > >The first argument to a module function is always going to be the module >object itself; so for this function (which you expect to take a single >string argument) you really need to list two arguments, e.g. > >static VALUE m_RunWithTimeout(VALUE rModule, VALUE rStr) >{ > char* cStr; > cStr = STR2CSTR(rStr); > printf("%s",cStr); >} > >Leave everything else the way you had it, and this should do the trick. > > Thanks for the quick reply! That worked. I didn't realize that you had to do this for module functions - it's almost like how methods are defined in Perl, first argument is self. Phil