From: timsuth@... (Tim Sutherland) Date: 2004-04-20T10:29:09+09:00 Subject: Re: Including a .so like a .dll? In article , Tim Sutherland wrote: [...] >Use the 'dl' library. Documentation is in the Ruby source at >ruby/ext/dl/doc/dl.txt. > >This works on both Windows and Linux (and others) and is even nicer than the >Win32API module. > >An example: > > require 'dl/import' > > module LIBC > extend DL::Importable > > dlload 'libc.so.6' > > typealias 'mode_t' 'unsigned int' Oops, should be typealias 'mode_t', 'unsigned int' > > extern 'int mkfifo(char*, mode_t)' > extern 'void perror(char*)' > end > > if -1 == LIBC.mkfifo('foo', 007) > LIBC.perror("mkfifo") > end I should also mention that dl supports structs and malloc in a nice way. It is a very nice library. IMHO the best part of Ruby 1.8 is that it includes dl.