From: Bertram Scharpf Date: 2008-09-02T03:42:29+09:00 Subject: rb_require() causes segfault Hi, calling rb_require() with a file name that will not be found, causes a segmentation fault to be raised: ruby: [BUG] Segmentation fault ruby 1.8.6 (2008-08-11) [i386-freebsd7] Abort trap: 6 (core dumped) It's the same with Linux (both gcc). I googled and found some answers that say: "Link with the -rdynamic flag." That did not help. Could anyone give me a hint what is going on here? At least a point to a working example should suffice. Thanks in advance, Bertram Here's my code: ---------------------------------------------------------------- #include VALUE call_require( VALUE name) { if (0) rb_raise( rb_eStandardError, "don't do it"); return rb_require( (char *) name); } VALUE rescue_require( VALUE data, VALUE err) { printf("Error: [[[%s]]]\n", RSTRING(rb_obj_as_string(err))->ptr); return Qnil; } void sure_require( char *name) { rb_rescue( &call_require, (VALUE) name, &rescue_require, Qnil); } int main( int argc, char *argv) { ruby_init(); ruby_init_loadpath(); sure_require( "nonexistent"); return 0; } ---------------------------------------------------------------- -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de