Forum: Ruby Ruby Embedding

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mike P. (Guest)
on 2009-04-01 22:15
Hello everybody.

I downloaded the ruby 1.9.1 for windows and i'm trying to embed using
C++ for 3 days and, i don't know but for some reason i'm getting crashes
with these functions:

...
rb_load_file
ruby_incpush
ruby_options
...

I searched for help but the documentation on ruby's website is for 1.8.?
and i can't find anywhere a good documentation for 1.9.1. Thanks in
advance.
Phlip (Guest)
on 2009-04-01 22:56
(Received via mailing list)
Mike Piazza wrote:

> I downloaded the ruby 1.9.1 for windows and i'm trying to embed using
> C++ for 3 days and, i don't know but for some reason i'm getting crashes
> with these functions:
>
> ..
> rb_load_file

Post a sample of your code, and the "crash" particulars. And what C++
are you using?
Mike P. (Guest)
on 2009-04-02 00:01
Phlip wrote:
> Mike Piazza wrote:
>
>> I downloaded the ruby 1.9.1 for windows and i'm trying to embed using
>> C++ for 3 days and, i don't know but for some reason i'm getting crashes
>> with these functions:
>>
>> ..
>> rb_load_file
>
> Post a sample of your code, and the "crash" particulars. And what C++
> are you using?


I'm using MSVC 2008 Express

The code:

extern "C"
{
  #include <ruby.h>
}

#include <iostream>
#include <conio.h>

RUBY_GLOBAL_SETUP

int main(int argc, char **argv)
{
    RUBY_INIT_STACK

    ruby_init();
    ruby_init_loadpath();
    ruby_script("embedded");

    void *file = rb_load_file("test.rb");
    ruby_run_node(file);

    return 1;
}
This topic is locked and can not be replied to.