From: Aaron Patterson Date: 2010-10-19T05:56:50+09:00 Subject: [ruby-core:32847] [Ruby 1.9-Bug#3752][Rejected] ruby/dl and segmentation fault Issue #3752 has been updated by Aaron Patterson. Status changed from Assigned to Rejected If you pass a wrong pointer to a function, it will segv just like the C code would segv. DL is not meant to protect you from errors you could also make in C. Here is an example of doing a null check, but with a crash. Provide a good file to taglib, and it won't crash. require 'dl' require 'dl/import' module Foo extend DL::Importer dlload '/opt/local/lib/libtag_c.dylib' extern 'void* taglib_file_tag(void*)' extern 'void* taglib_file_new(char*)' end taglib_file = Foo.taglib_file_new(ARGV[0] || 'foo') if taglib_file.null? puts "bad file" Foo.taglib_file_tag(taglib_file) # This will SEGV because it's a NULL pointer else file_tag = Foo.taglib_file_tag(taglib_file) end ---------------------------------------- http://redmine.ruby-lang.org/issues/show/3752 ---------------------------------------- http://redmine.ruby-lang.org