------art_1722_9208729.1196805768716
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I solved the problem, the method NtInitialize() was missing before
ruby_init()

right code:

int argc  ;
char **argv  ;

NtInitialize(&argc,&argv);

ruby_init();

...

2007/12/4, Teofilo Dutra <teofilo.dutra / gmail.com>:
>
> Hi,
>
> I'm  trying to use a ruby script in c++ which uses the method get of a
> Net::HTTP object,
> when I run it(script) in prompt it works, but when I run it in C++ it
> returns an error in the get line.
>
> ruby :
>
> require "net/http"
>
> #
> # some code...
> #
>
> page  www.somepage.com"
> port  0
> param  someparam"
>
> conn  et::HTTP.new(page,port)
> resp,data  onn.get(param)                                    # get line
> :P
>
> #
> # some code...
> #
>
> c++ :
>
> ruby_init();
> ruby_script("script");
>
> char *args[] > {
>      "param",
>       NULL
> };
>
> ruby_set_argv((sizeof(args) / sizeof(args[0])) - 1, args);
>
> ruby_init_loadpath();
> rb_load_file("script.rb");
> int status  uby_exec();
>
> ruby_cleanup(status);
> ruby_finalize();
>
> Error :
>
> ../lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo:
> non-recoverab
> le failure in name resolution. (SocketError) from
> d:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect' from
> d:/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout' from
> d:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' from
> d:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect' from
> d:/ruby/lib/ruby/1.8/net/http.rb:553:in `do_start' from
> d:/ruby/lib/ruby/1.8/net/http.rb:542:in `start' from
> d:/ruby/lib/ruby/1.8/net/http.rb:1029:in `request' from
> d:/ruby/lib/ruby/1.8/net/http.rb:769:in `get' from script.rb:53
>
> What's missing ? or What's wrong ? Why does the script work in prompt and
> not work in C++ ?
>

------art_1722_9208729.1196805768716--