From: "U.Nakamura" Date: 2012-04-26T16:55:38+09:00 Subject: [ruby-core:44641] Re: [ruby-trunk - Bug #6364] Segmentation fault happend when running test_cptr.rb Hello, In message "[ruby-core:44640] [ruby-trunk - Bug #6364] Segmentation fault happend when running test_cptr.rb" on Apr.26,2012 14:15:30, wrote: > Yes, My target is to provide the most compatiable ruby binray of Windows. Most Ruby ext include fiddle,syslog has been compiled except pty. and the test result of fiddel is zero error, as following: Oh, sorry, I'd misunderstood. OK, make minimum reproduce case. What does this script output? -- cut here -- require "dl" require "rbconfig" libc_so = libm_so = RbConfig::CONFIG["RUBY_SO_NAME"].split(/-/).find{|e| /^msvc/ =~ e} + ".dll" p DL.fiddle? open(__FILE__) do |f| p buf = DL::CPtr.malloc(10) p fp = DL::CPtr.to_ptr(f) p fread = DL::CFunc.new(DL.dlopen(libc_so)['fread'], DL::TYPE_VOID, 'fread') p fread.([buf.to_i, 1, buf.size - 1, fp.to_i]) p buf.to_s end -- cut here -- Regards, -- U.Nakamura