From: Mr_Tibs Date: 2008-07-11T01:21:02+09:00 Subject: calling c++ from Ruby Hi, I wrote this question on the newsgroup yesterday, but I didn't see it actually get posted. Here it goes again. I'm trying to call a c++ function from Ruby and I'm getting some errors compiling the c++ part. Here is my code: #include "ruby.h" #include #include VALUE MyTest = Qnil; extern "C" VALUE create_project(char *c, ...) { va_list args; va_start(args, c); } extern "C" void Init_mytest() { MyTest = rb_define_module("MyTest"); rb_define_method(MyTest, "create_project", &create_project, 1); } And here is the error: MyTest.cpp: In function ‘void Init_mytest()’: MyTest.cpp:16: error: invalid conversion from ‘VALUE (*)(char*, ...)’ to ‘VALUE (*)(...)’ MyTest.cpp:16: error: initializing argument 3 of ‘void rb_define_method(VALUE, const char*, VALUE (*)(...), int)’ If I don't put "char *c" in the arguments of create_project, it compiles and works just fine. But if I don't have it, how can I get the arguments? I realize this is more of a c++ question, but if anyone has any simple, fully working example of calling c++ code from Ruby, I would like to see it. Thanks, Tiberiu