From: Stephen Kellett Date: 2005-11-23T20:07:24+09:00 Subject: Re: Help embedding Ruby in Visual C++ project In message <1132700093.526946.71730@g47g2000cwa.googlegroups.com>, stevewong4@gmail.com writes >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? When we want to test something in Ruby using C we have a test harness. I've stripped out the non-relevant code to reveal this. Hope it helps Stephen int main(int argc, char* argv[]) { NtInitialize(&argc, &argv); ruby_init(); ruby_script("embedded"); char *args[] = { "arg1", "arg2", "arg3", NULL }; ruby_set_argv((sizeof(args) / sizeof(args[0])) - 1, args); char *options[] = { "", NULL }; ruby_options(0, options); // required to setup TK properly ruby_init_loadpath(); rb_load_file("d:\\ruby_1_8_2_15\\samples\\tk\\tkhello.rb"); ruby_run(); return 0; } -- Stephen Kellett Object Media Limited http://www.objmedia.demon.co.uk/software.html Computer Consultancy, Software Development Windows C++, Java, Assembler, Performance Analysis, Troubleshooting