From: "Niklas C." Date: 2008-04-29T09:51:12+09:00 Subject: converting strings in c extension While trying to bind some old C code to ruby I ran into trouble converting strings. The function in question requires two string arguments (const char*). This is the relevant part of my binding: ... static VALUE rb_ldist(VALUE s, VALUE t) { return INT2FIX(ldist(StringValuePtr(s),StringValuePtr(t))); } ... Compilation works without warnings, but when I try to use the function in ruby with ldist 'foo','bar' it gives me can't convert Object into String (TypeError) Why is it an Object and not a String? I also tried to use RSTRING(s)->ptr insead of StringValuePtr, but that gave me an invalid pointer. Any suggestions on what to do here? thanks in advance for any help. -- Posted via http://www.ruby-forum.com/.