P
Phlip
Rubinistas:
#include "C:\ruby\lib\ruby\1.8\i386-mswin32\ruby.h"
#pragma comment(lib, "C:/ruby/lib/msvcrt-ruby18.lib")
int main(int argc, char* argv[])
{
ruby_init();
ruby_script("embedded");
FILE * out = freopen("c:/temp/redirect.txt", "w", stdout);
FILE * err = freopen("c:/temp/redirect.txt", "w", stderr);
rb_eval_string("puts 'hello world'\n");
return 0;
}
That code expects to evaluate a Ruby script, inside C/C++, and capture its
output into c:/temp/redirect.txt.
Ideally, I'd like to get the results into a stream, so I can pull it in
realtime as Ruby pushes it. But reading that temp file is an acceptable
compromise.
However, that code simply crashes, deep inside malloc.c inside Ruby. Anyone
know why, or if there's a better way?
#include "C:\ruby\lib\ruby\1.8\i386-mswin32\ruby.h"
#pragma comment(lib, "C:/ruby/lib/msvcrt-ruby18.lib")
int main(int argc, char* argv[])
{
ruby_init();
ruby_script("embedded");
FILE * out = freopen("c:/temp/redirect.txt", "w", stdout);
FILE * err = freopen("c:/temp/redirect.txt", "w", stderr);
rb_eval_string("puts 'hello world'\n");
return 0;
}
That code expects to evaluate a Ruby script, inside C/C++, and capture its
output into c:/temp/redirect.txt.
Ideally, I'd like to get the results into a stream, so I can pull it in
realtime as Ruby pushes it. But reading that temp file is an acceptable
compromise.
However, that code simply crashes, deep inside malloc.c inside Ruby. Anyone
know why, or if there's a better way?