[ANN] ruby-dl2-0.0

Hello,

It's my pleasure to inform you that Ruby/DL2 has come out.

  http://rubyforge.org/projects/ruby-dl2/

I made it work with both of ruby-1.8 and ruby-1.9. Please try
it and let me know what you think except for incompatibility
between Ruby/DL and Ruby/DL2. I have a plan to replace Ruby/DL
of ruby-1.9 with Ruby/DL2 after hearing serveral opinions.

Best regards,

P.S.
I'd like you to read test/test_import.rb instead of a tutorial,
since there is no documentation about Ruby/DL2.

···

--
Takaaki Tateishi <ttate@ttsky.net>

Takaaki Tateishi wrote:

Hello,

It's my pleasure to inform you that Ruby/DL2 has come out.

  http://rubyforge.org/projects/ruby-dl2/

I made it work with both of ruby-1.8 and ruby-1.9. Please try
it and let me know what you think except for incompatibility
between Ruby/DL and Ruby/DL2. I have a plan to replace Ruby/DL
of ruby-1.9 with Ruby/DL2 after hearing serveral opinions.

Best regards,

P.S.
I'd like you to read test/test_import.rb instead of a tutorial,
since there is no documentation about Ruby/DL2.

Thanks for giving this to ruby 1.8!

I wasn't going to read this post because I assumed it'll only be for
Ruby 1.9. Glad I did!

Installing with ruby 1.9.0 (2005-01-27) [i686-linux],

tim@alien:~/d/ruby-dl2-0.0$ ruby extconf.rb
checking for dlfcn.h... yes
checking for main() in -ldl... yes
checking for dlopen()... yes
checking for dlclose()... yes
checking for dlsym()... yes
checking for dlerror()... yes
creating Makefile
/usr/local/stow/ruby-cvs//lib/ruby/1.9/mkmf.rb:875: warning: global variable `$preload' not initialized

tim@alien:~/d/ruby-dl2-0.0$ make
gcc -fPIC -g -O2 -fno-defer-pop -fno-omit-frame-pointer -I. -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I. -DHAVE_DLFCN_H -DHAVE_DLOPEN -DHAVE_DLCLOSE -DHAVE_DLSYM -DHAVE_DLERROR -c cfunc.c
gcc -fPIC -g -O2 -fno-defer-pop -fno-omit-frame-pointer -I. -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I. -DHAVE_DLFCN_H -DHAVE_DLOPEN -DHAVE_DLCLOSE -DHAVE_DLSYM -DHAVE_DLERROR -c cptr.c
generating callback.h
../mkcallback.rb:126:in `%': too many arguments for format string (ArgumentError)
  from ./mkcallback.rb:126
  from ./mkcallback.rb:111:in `each'
  from ./mkcallback.rb:111
  from ./mkcallback.rb:110:in `each'
  from ./mkcallback.rb:110
  from ./mkcallback.rb:109:in `each'
  from ./mkcallback.rb:109
  from ./mkcallback.rb:100:in `each'
  from ./mkcallback.rb:100
make: *** [callback.h] Error 1

(NB: At this point callback.h exists.)

If we run make again, the build succeeds but trying to require 'dl' produces
irb: relocation error:
/usr/local/stow/ruby-cvs//lib/ruby/site_ruby/1.9/i686-linux/dl.so: undefined
symbol: rb_dl_init_callbacks

Apart from fixing the bug is causing the error, I guess mkcallback.rb
should delete callback.h if an exception reaches the top-level.

The actual bug in question is caused by the line
      return #{DLTYPE[ty][:conv] % "ret"};

Most of the time we have things like
  INT => {
    :name => 'int',
    :type => 'int',
    :conv => 'NUM2INT(%s)',
  }

but there is also

  VOID => {
    :name => 'void',
    :type => 'void',
    :conv => "",
  }

Thanks for all your work. Ruby/DL has long been my favourite Ruby extension
:slight_smile:

···

In article <41F93283.9060409@ttsky.net>, Takaaki Tateishi wrote:

Hello,

It's my pleasure to inform you that Ruby/DL2 has come out.

http://rubyforge.org/projects/ruby-dl2/

I made it work with both of ruby-1.8 and ruby-1.9. Please try
it and let me know what you think except for incompatibility
between Ruby/DL and Ruby/DL2. I have a plan to replace Ruby/DL
of ruby-1.9 with Ruby/DL2 after hearing serveral opinions.

Best regards,

P.S.
I'd like you to read test/test_import.rb instead of a tutorial,
since there is no documentation about Ruby/DL2.

Tim Sutherland wrote:

tim@alien:~/d/ruby-dl2-0.0$ make
gcc -fPIC -g -O2 -fno-defer-pop -fno-omit-frame-pointer -I. -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I. -DHAVE_DLFCN_H -DHAVE_DLOPEN -DHAVE_DLCLOSE -DHAVE_DLSYM -DHAVE_DLERROR -c cfunc.c
gcc -fPIC -g -O2 -fno-defer-pop -fno-omit-frame-pointer -I. -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I. -DHAVE_DLFCN_H -DHAVE_DLOPEN -DHAVE_DLCLOSE -DHAVE_DLSYM -DHAVE_DLERROR -c cptr.c
generating callback.h
../mkcallback.rb:126:in `%': too many arguments for format string (ArgumentError)
  from ./mkcallback.rb:126

I think you run ruby-1.9 with the option '-d' or '--verbose'.
I modified mkcallback.rb, fixed another problem and released ruby-dl2-0.1.zip.

Thanks,

···

--
Takaaki Tateishi <ttate@ttsky.net>

Yes, I have "RUBYOPT=-w".

ruby-dl2-0.1 builds fine and running test/test_all.rb produces
28 tests, 43 assertions, 0 failures, 0 errors

Thanks.

···

In article <41F9FBD3.20402@ttsky.net>, Takaaki Tateishi wrote:

Tim Sutherland wrote:

tim@alien:~/d/ruby-dl2-0.0$ make
gcc -fPIC -g -O2 -fno-defer-pop -fno-omit-frame-pointer -I. -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I. -DHAVE_DLFCN_H -DHAVE_DLOPEN -DHAVE_DLCLOSE -DHAVE_DLSYM -DHAVE_DLERROR -c cfunc.c
gcc -fPIC -g -O2 -fno-defer-pop -fno-omit-frame-pointer -I. -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I/usr/local/stow/ruby-cvs//lib/ruby/1.9/i686-linux -I. -DHAVE_DLFCN_H -DHAVE_DLOPEN -DHAVE_DLCLOSE -DHAVE_DLSYM -DHAVE_DLERROR -c cptr.c
generating callback.h
../mkcallback.rb:126:in `%': too many arguments for format string (ArgumentError)
  from ./mkcallback.rb:126

I think you run ruby-1.9 with the option '-d' or '--verbose'.
I modified mkcallback.rb, fixed another problem and released ruby-dl2-0.1.zip.