From: stevewong4@... Date: 2005-11-23T07:57:24+09:00 Subject: Help embedding Ruby in Visual C++ project Hi, I am trying to embed Ruby within a Visual C++ project, but I am having trouble loading my script file. How do I tell the Ruby interpreter where to look for my script file? If I use ruby_options(), then my program hangs. So, I am trying to pass the "-S" flag to Ruby, and I have set RUBYPATH to the directory where "test.rb" lives. Note: I am able to load the script if I put the script in the same directory as my source files (which isn't the same directory as the built C++ .exe). I do not understand why this works. Ideally, I would like to tell the Ruby interpreter where to find my "test.rb" script. How do I do this? Thanks in advance for your help. Here is a code snippet: int state; int rargc=2; char *rargv[2], rarg1[MAX_PATH] strcpy(rarg1, "-S"); rargv[0] = "ruby"; rargv[1] = rarg1; NtInitialize(&rargc, (char ***)&rargv); ruby_init(); ruby_init_loadpath(); rb_load_protect(rb_str_new2("test.rb"), Qfalse, &state);