RUBY/dl bug?

I was trying out the RUBY/DL samples which can be downloaded from:
   http://ttsky.net/ruby/ruby-dl-sample/win32/
and while trying out the stream.rb example, I got the following error on
Win XP (Home) using ruby one-click install:

···

--------------------------------------------------------------
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>cd downloads\_ruby

C:\downloads\_ruby>ruby stream.rb stream.rb
c:/ruby/lib/ruby/1.8/dl/types.rb:73:in `pack': bignum out of range of
unsigned long (RangeError)
        from c:/ruby/lib/ruby/1.8/dl/types.rb:73
        from c:/ruby/lib/ruby/1.8/dl/types.rb:73:in `call'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:210:in `encode_types'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:210:in `call'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:206:in `encode_types'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:206:in `call'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:206:in `encode_types'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:206:in `call'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:206:in `encode_types'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:206:in `call'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:206:in `encode_types'
        from c:/ruby/lib/ruby/1.8/dl/import.rb:206:in `call'
        from (eval):8:in `createFile'
        from stream.rb:31:in `streams'
        from stream.rb:79
        from stream.rb:77:in `each'
        from stream.rb:77

C:\downloads\_ruby>ruby -v
ruby 1.8.1 (2003-12-25) [i386-mswin32]

C:\downloads\_ruby>
-------------------------------------------------------------------------

Shashank Date wrote:

I was trying out the RUBY/DL samples which can be downloaded from:
   http://ttsky.net/ruby/ruby-dl-sample/win32/
and while trying out the stream.rb example, I got the following error on
Win XP (Home) using ruby one-click install:
--------------------------------------------------------------
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>cd downloads\_ruby

C:\downloads\_ruby>ruby stream.rb stream.rb
c:/ruby/lib/ruby/1.8/dl/types.rb:73:in `pack': bignum out of range of
unsigned long (RangeError)
        from c:/ruby/lib/ruby/1.8/dl/types.rb:73

Hi Shanko,

I think it's a Ruby bug that was fixed.

Fri Jan 23 02:26:30 2004 Yukihiro Matsumoto

  * pack.c (num2i32): pack should not raise RangeError.
    [ruby-dev:22654]

As a work-around, try changing line 73 in dl/types.rb
from:
proc{|v| [v].pack("l").unpack("L")[0]}],
to:
proc{|v| [v & 0xffffffff].pack("l").unpack("L")[0]}],

daz