C#, C♯, C#相談室 Pa ..
[2ch|▼Menu]
528:デフォルトの名無しさん
08/05/27 10:23:17
>>524
それはるびまの記事の話だろう。
あのスレの>>875はこんなコード。GC.KeepAliveを抜いたらクラッシュする。

static void Main(string[] args)
{
VALUE state = 0;
Ruby.ruby_init();
const string funcdef =
"def foo\n" +
"s=\"FOO\"+nil\n"+
"end";
Ruby.rb_eval_string_protect(funcdef, ref state);
VALUE hoge = Ruby.rb_intern("hoge");
Ruby.CallbackArg0 func = arg => Ruby.rb_funcall(Ruby.Qnil, hoge, 0, 0);
VALUE result = Ruby.rb_protect(func, Ruby.Qnil, ref state);
GC.KeepAlive(func);
}


次ページ
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4186日前に更新/244 KB
担当:undef