How can I convert a C++ std::string
object into a Ruby VALUE
object?
I tried rb_str_new2(c_string)
, but it did not work.
I have a function
VALUE foo(){return rb_str_new2(c_string);};
and that gives an error message:
cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘const char*’ for argument ‘1’ to ‘size_t strlen(const char*)’