B
Brian Schröder
Hello Group,
I'm asking myself what is the way to create a ruby object correctly from
a C extension. As I've extracted from ruby.h and README.EXT the things I
can come up with are:
rb_funcall(rb_const_get(self, rb_intern('Complex')), rb_intern('new'), 2, rb_float_new(real), rb_float_new(imag));
// which is impressively complicated and long.
rb_eval_string(constructing_string)
// Which is ugly because of eval and because of C string functions.
This seems to be really complicated just for wrapping my C complex
numbers into ruby Complex numbers.
So as I always have seen that things are easier in ruby, what should I
do?
Thanks a lot,
Brian
I'm asking myself what is the way to create a ruby object correctly from
a C extension. As I've extracted from ruby.h and README.EXT the things I
can come up with are:
rb_funcall(rb_const_get(self, rb_intern('Complex')), rb_intern('new'), 2, rb_float_new(real), rb_float_new(imag));
// which is impressively complicated and long.
rb_eval_string(constructing_string)
// Which is ugly because of eval and because of C string functions.
This seems to be really complicated just for wrapping my C complex
numbers into ruby Complex numbers.
So as I always have seen that things are easier in ruby, what should I
do?
Thanks a lot,
Brian