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]
Well, ruby use the variable $LOAD_PATH to know where it must search a
library. This is this variable which is initialized when you call
rb_init_loadpath() and by default (with $SAFE == 0) it add `.', the
current directory, in it. This is why it find the script when it's in the
current directory.
You can use, ruby_incpush() if you want to add directories to this
variable.
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?
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting