[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: trouble with ruby_options() on win32 and ruby 1.8.2

e

1/18/2005 10:19:00 PM

> 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.h...
and http://www.ruby-doc.org/doxygen/1.8.1/ruby_8c-source.h...
and http://www.ruby-doc.org/doxygen/1.8.1/ruby_8c-source.h...

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

E



1 Answer

David Craine

1/19/2005 4:50:00 PM

0


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.h...
> and http://www.ruby-doc.org/doxygen/1.8.1/ruby_8c-source.h...
> and http://www.ruby-doc.org/doxygen/1.8.1/ruby_8c-source.h...
>
> 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.