From: Lyle Johnson Date: 2001-07-12T00:16:13+09:00 Subject: [ruby-talk:17658] Re: SWIG and strings > >Any ideas for writing the typemap for strings in ruby or is > >there any reference material for swig and ruby on typemaps? > > %typemap(ruby,out) string, const string & { > $target = rb_str_new2($source->c_str()); > }; > .... and for completeness' sake, %typemap(ruby, in) string, const string & { Check_Type($source, T_STRING); $target = new string(STR2CSTR($source)); } %typemap(ruby, freearg) string, const string & { delete $source; }