From: ts Date: 2006-07-28T01:46:57+09:00 Subject: Re: Embedded socket error >>>>> "N" == Nathan Whitney writes: N> static VALUE wrap_run( VALUE arg1 ) { ^^^^^^^^^^ N> rb_load_file( StringValueCStr( arg1 ) ); ^^^^ N> return Qnil; N> } N> static VALUE protected_run( VALUE script ) { N> int error; N> VALUE args[1]; ^^^^^^^^^^^^^ N> VALUE result; N> args[0] = script; ^^^^^^^ N> result = rb_protect( wrap_run, (VALUE)args, &error ); ^^^^ N> return error ? Qnil : result; N> } You give a C array to wrap_run() and then inside wrap_run() you interpret it as a VALUE. Now if you want to do something similar to "load 'embed.rb'", you have the function void rb_load_protect(VALUE fname, int wrap, int *state); which call rb_load() inside the equivalent of rb_protect() Guy Decoux