From: Tobias Peters Date: 2004-04-02T21:14:25+09:00 Subject: Re: swig problem dominic sisneros wrote: > I do a typemap as follows > > I tried this but am still getting a TypeError converting Nil to String > > %typemap(ruby,in) const char *identifier { > if $input == Qnil{ > $1 == NULL; > else > $1 = STR2CSTR($input); > } > } Rerun swig and recompile your extension before trying again ;) I can see you didn't because there are 2 syntax errors (and 1 semantic error) in your typemap. Your compiler would have caught the 2 syntax ones. Or maybe you just didn't notice the error messages. - C requires that you parenthesize the test expression after the "if" - Your "else" has no previous "if" (removing the inner braces will help) - "$1 == NULL" doesn't do anything. Apart from these errors, your typemap is correct and your code will work once you correct them. Tobias