Project

General

Profile

Actions

Bug #1511

closed

"[BUG] Segmentation fault" with Win32API

Added by bbr322 (Br Hug) almost 12 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32]
Backport:
[ruby-core:23544]

Description

=begin
I try to build ruby with Intel C++ compiler (w_cc_p_10.1.021), it works, mostly.

When I do nmake test, I got this:

D:/Temp/ruby-1.9.1-p129/win32/build/.ext/common/Win32API.rb:23: [BUG] Segmentation fault
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32]

-- control frame ----------
c:0009 p:---- s:0031 b:0031 l:000030 d:000030 CFUNC :call
c:0008 p:0039 s:0027 b:0027 l:000026 d:000026 METHOD D:/Temp/ruby-1.9.1-p129/win32/build/.ext/common/Win32API.rb:23
c:0007 p:0102 s:0021 b:0021 l:000020 d:000020 CLASS D:/Temp/ruby-1.9.1-p129/lib/tmpdir.rb:20
c:0006 p:0021 s:0014 b:0014 l:000013 d:000013 TOP D:/Temp/ruby-1.9.1-p129/lib/tmpdir.rb:9
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC :require
c:0003 p:0025 s:0006 b:0006 l:001284 d:0013ac EVAL ../../bootstraptest/runner.rb:10
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001284 d:001284 TOP :371


-- Ruby level backtrace information-----------------------------------------
D:/Temp/ruby-1.9.1-p129/win32/build/.ext/common/Win32API.rb:23:in call'
D:/Temp/ruby-1.9.1-p129/win32/build/.ext/common/Win32API.rb:23:in
call'
D:/Temp/ruby-1.9.1-p129/lib/tmpdir.rb:20:in <class:Dir>'
D:/Temp/ruby-1.9.1-p129/lib/tmpdir.rb:9:in
'
../../bootstraptest/runner.rb:10:in require'
../../bootstraptest/runner.rb:10:in
'
=end

Actions #1

Updated by bbr322 (Br Hug) almost 12 years ago

=begin
require 'win32api'

func = Win32API.new('Kernel32', 'GetModuleHandle', 'I', 'I')
# => [BUG] cfp consistency error - send

func = Win32API.new('Kernel32', 'GetModuleHandle', 'I', 'I', :stdcall)
# => OK

p func.call(0)


D:/Opt/ruby-1.9.1-p129-icl/lib/ruby/1.9.1/Win32API.rb:23: [BUG] cfp consistency error - send
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32]

-- control frame ----------
c:0005 p:---- s:0018 b:0018 l:000017 d:000017 CFUNC :call
c:0004 p:0039 s:0014 b:0014 l:000013 d:000013 METHOD D:/Opt/ruby-1.9.1-p129-icl/lib/ruby/1.9.1/Win32API.rb:23
c:0003 p:0052 s:0008 b:0007 l:000b24 d:001040 EVAL tt.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000b24 d:000b24 TOP :443


-- Ruby level backtrace information-----------------------------------------
D:/Opt/ruby-1.9.1-p129-icl/lib/ruby/1.9.1/Win32API.rb:23:in call'
D:/Opt/ruby-1.9.1-p129-icl/lib/ruby/1.9.1/Win32API.rb:23:in
call'
tt.rb:4:in `'


Maybe we should change

def initialize(dllname, func, import, export = "0", *rest)

to

def initialize(dllname, func, import, export = "0", call_type = :stdcall, *rest)

and

@func = DL::CFunc.new(handle[func], TYPEMAP[export.tr("VPpNnLlIi", "0SSI")], func, *rest)

to

@func = DL::CFunc.new(handle[func], TYPEMAP[export.tr("VPpNnLlIi", "0SSI")], func, call_type, *rest)

in Win32API.rb? Because most of Windows APIs use STDCALL convention.

I've no idea why i386-mswin32(VC) and i386-mingw32 worked with :cdcel...
=end

Actions #2

Updated by rogerdpack (Roger Pack) almost 12 years ago

=begin
Interesting. Does indeed work ok with mingw 1.9.1

func = Win32API.new('Kernel32', 'GetModuleHandle', 'I', 'I')
=> #>

-=r
=end

Actions #4

Updated by yugui (Yuki Sonoda) almost 12 years ago

  • Status changed from Open to Closed

=begin

=end

Actions

Also available in: Atom PDF