[Bug #1451] dl in ruby-1.9 can't parse signatures correctly

Bug #1451: dl in ruby-1.9 can’t parse signatures correctly.

e$B5/I<<Te(B: Takashi T.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: ext, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2009-05-02 trunk 23326) [i686-linux]

1.9 e$B$Ne(B dl e$B$Ne(B cparser.rb
e$B$,6uGr$,$"$k%7%0%M%A%[email protected]$7$/%Q!<%9$G$-$^$;$s!#e(B

$ cat d7.rb
require ‘dl/import’

module M
extend DL::Importer
dlload ‘libc.so.6’
extern ‘void * memmove(void *, void *, unsigned long

$ ruby-1.9 -v d7.rb
ruby 1.9.2dev (2009-05-02 trunk 23326) [i686-linux]
parse_ctype': unknown type: unsigned long (DL::DLError) from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/cparser.rb:53:inblock in parse_signature’
from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/cparser.rb:53:in
collect' from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/cparser.rb:53:inparse_signature’
from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/import.rb:116:in
extern' from d7.rb:6:inmodule:M
from d7.rb:3:in `’


$ svn diff lib/dl/cparser.rb
Index: lib/dl/cparser.rb

— lib/dl/cparser.rb (e$B%j%S%8%g%se(B 23328)
+++ lib/dl/cparser.rb (e$B:n6H%3%T!<e(B)
@@ -41,7 +41,7 @@ module DL
case signature
when /^([\d\[email protected]*\s]+)(([\d\w*\s,[]]*))$/
ret = $1

  •    args = $2
  •    args = $2.sub(/\A\s*/, '').sub(/\s*\z/, '')
       ret = ret.split(/\s+/)
       args = args.split(/\s*,\s*/)
       func = ret.pop

e$B%A%1%C%He(B #1451 e$B$,99?7$5$l$^$7$?!#e(B (by Nobuyoshi N.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r23382.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs