DesertPenguin
2007.01.05, 02:01 PM
I have decided to try using Ruby instead of Lua for scripting.
I keep getting the following compiler error which is confusing me:
g++ -g -c main.cpp -I/Developer/ruby-1.8.5
main.cpp: In function 'int main(int, const char**)':
main.cpp:21: error: invalid conversion from 'VALUE (*)()' to 'VALUE (*)(...)'
main.cpp:21: error: initializing argument 2 of 'void rb_define_global_function(const char*, VALUE (*)(...), int)'
My source:
VALUE callback(void)
{
printf("C callback\n");
return T_TRUE;
}
int main (int argc, const char * argv[])
{
ruby_init();
// dumps the version info to stdout
ruby_show_version();
//define that callback below
rb_define_global_function("c_callback", callback, 0);
ruby_init_loadpath();
/* //////////////////////////// */
rb_load_file("rubydefs.rb");
int status;
status = ruby_exec();
status = ruby_exec();
status = ruby_cleanup(status);
/* //////////////////////////// */
ruby_finalize();
fprintf(stdout, "this is the end");
return 0;
}
What is VALUE(*)(...) as opposed to VALUE(*)()?
Thanks for any tips....
I keep getting the following compiler error which is confusing me:
g++ -g -c main.cpp -I/Developer/ruby-1.8.5
main.cpp: In function 'int main(int, const char**)':
main.cpp:21: error: invalid conversion from 'VALUE (*)()' to 'VALUE (*)(...)'
main.cpp:21: error: initializing argument 2 of 'void rb_define_global_function(const char*, VALUE (*)(...), int)'
My source:
VALUE callback(void)
{
printf("C callback\n");
return T_TRUE;
}
int main (int argc, const char * argv[])
{
ruby_init();
// dumps the version info to stdout
ruby_show_version();
//define that callback below
rb_define_global_function("c_callback", callback, 0);
ruby_init_loadpath();
/* //////////////////////////// */
rb_load_file("rubydefs.rb");
int status;
status = ruby_exec();
status = ruby_exec();
status = ruby_cleanup(status);
/* //////////////////////////// */
ruby_finalize();
fprintf(stdout, "this is the end");
return 0;
}
What is VALUE(*)(...) as opposed to VALUE(*)()?
Thanks for any tips....