Trouble with ruby_options() on win32 and ruby 1.8.2

Lähettäjä: David Craine <dave@infoether.com>
Aihe: trouble with ruby_options() on win32 and ruby 1.8.2

I'm trying to embed ruby into a win32 application; however, when
calling the ruby_options() method my process simply hangs. I am trying
to use ruby_options() to pass the -C argument to ruby to set the
current directory. My code looks like this:

UINT launchRuby()
{
  char *argv[3] =
  {
    "ruby",
    "-C..\\Release",
    "test.rb"
  }

  ruby_init();
  ruby_options(3, argv);
  ruby_run();
}

My program compiles and links properly; however, when I run it it just
hangs right after the ruby_options() call (I've integrated some
diagnostic code to determine this). This same technique worked fine on
OSX, so I'm wondering if there is some issue with the Windows platform.

See http://www.ruby-doc.org/doxygen/1.8.1/eval_8c-source.html#l01345
and http://www.ruby-doc.org/doxygen/1.8.1/ruby_8c-source.html#l01104
and http://www.ruby-doc.org/doxygen/1.8.1/ruby_8c-source.html#l00425

It looks like the first argument may have to be the script name.

E

Actually, the source code indicates that the first argument should be the ruby program name, i.e., "ruby". This is how it worked on OSX and should be the same on win32. thanks for the idea, though.

···

On Jan 18, 2005, at 5:18 PM, E S wrote:

Lähettäjä: David Craine <dave@infoether.com>
Aihe: trouble with ruby_options() on win32 and ruby 1.8.2

I'm trying to embed ruby into a win32 application; however, when
calling the ruby_options() method my process simply hangs. I am trying
to use ruby_options() to pass the -C argument to ruby to set the
current directory. My code looks like this:

UINT launchRuby()
{
  char *argv[3] =
  {
    "ruby",
    "-C..\\Release",
    "test.rb"
  }

  ruby_init();
  ruby_options(3, argv);
  ruby_run();
}

My program compiles and links properly; however, when I run it it just
hangs right after the ruby_options() call (I've integrated some
diagnostic code to determine this). This same technique worked fine on
OSX, so I'm wondering if there is some issue with the Windows platform.

See http://www.ruby-doc.org/doxygen/1.8.1/eval_8c-source.html#l01345
and http://www.ruby-doc.org/doxygen/1.8.1/ruby_8c-source.html#l01104
and http://www.ruby-doc.org/doxygen/1.8.1/ruby_8c-source.html#l00425

It looks like the first argument may have to be the script name.

E