From: Friedrich Dominicus Date: 2003-03-01T00:03:51+09:00 Subject: Re: I'm stuck As said I rewrote it a bit it now looks like this (no error handling!) /* Generated header * File Name : t1.c * * Created : 2003-02-28 09:57:47 frido * Author : Friedrich Dominicus * Time-stamp: <> */ #include #include int main (void){ int i; VALUE obj; VALUE klass; ruby_init(); ruby_init_loadpath(); /* uby_script("embed"); rb_load_file("t1.rb"); */ //obj = rb_eval_string("load 't1.rb'"); rb_require("t1"); klass = rb_const_get(rb_cObject, rb_intern("T1")); obj = rb_cv_get(klass, "@@some_var"); for (i = 0; i < RARRAY(obj)->len; ++i){ printf("obj[%d] = %s\n", i, STR2CSTR(rb_ary_entry(obj,i))); } return 0; } This works and gives: obj[0] = String1 obj[1] = String2 obj[2] = String3 But now the very same program under Windows (just modified to call NtInitialize before somethint else crashes after rb_const_get this is the source I want to use under Windows: #include #include int main (int argc, char**argv){ int i; VALUE obj; VALUE klass; NtInitialize(&argc, &argv); ruby_init(); ruby_init_loadpath(); rb_require("t1"); klass = rb_const_get(rb_cObject, rb_intern("T1")); obj = rb_cv_get(klass, "@@some_var"); for (i = 0; i < RARRAY(obj)->len; ++i){ printf("obj[%d] = %s\n", i, STR2CSTR(rb_ary_entry(obj,i))); } return 0; } I can not see why it works on Linux but crashes on Windows It really would be helpful is someone has something that simple working and could give me hand. Regards Friedrich