> Use rb_String(num) or rb_big2str(num, 10).
I would like to get the string representation of an arbitrary Ruby
object. (The Bignum was just a specific example.)
Thanks for the pointer to rb_String(). It isn't mentioned in my
README.EXT, which says, on the contrary:
***
To get char* from a VALUE, version 1.7 recommend to use new macros
StringValue() and StringValuePtr(). StringValue(var) replaces var's
value to the result of "var.to_str()". StringValuePtr(var) does same
replacement and returns char* representation of var. These macros
will skip the replacement if var is a String. Notice that the macros
requires to take only lvalue as their argument, to change the value
of var in the replacement.
***
I read that as saying that StringValue() and StringValuePtr() (and thus
StringValueCStr()) should work on any type of object. I wouldn't have
guessed they only worked on string-type objects.
Thanks,
-- Timothy