From: Shashank Date Date: 2003-06-24T11:02:40+09:00 Subject: Re: collect info about ruby-api "Shashank Date" wrote in message > I am still trying to figure out how to convert it into > a fully working C program (like all the other code examples). To be more specific, I am on WIN XP Pro, using VC++ 6.0 The following code does not work (it crashes and asks me if I want to send the error report to Microsoft. Probably because I do not know how "... to tell the Ruby's garbage collector that there is a new instance in town" ) I have tested all the other programs and they all work fine so I don't think there is a problem with setting up my VisualStudio 6.0 environment. Any suggestions ? TIA -- shanko //------------------------------------------------------------------- #include int main(int Argc, char **Argv) { int argc; VALUE argv[2]; VALUE class; VALUE instance; ruby_init(); argv[0] = INT2FIX(42); argv[1] = rb_str_new2("hello world"); argc = 2; /* ----- This does not work either: class = rb_path2class("TestClass"); instance = rb_class_new_instance(argc, argv, class); */ class = rb_const_get(rb_cObject, rb_intern("TestClass")); instance = rb_funcall2(class, rb_intern("new"), argc, argv); ruby_finalize(); return 0; } //-------------------------------------------------------------------