Subject: Re: [ruby-ffi] invalid ELF header on hello world example |
From: Luis Lavena |
Date: 5/26/10 6:28 PM |
To: ruby-ffi@googlegroups.com |
On Wed, May 26, 2010 at 8:25 PM, Wayne Meissner <wmeissner@gmail.com> wrote:
Don't use 'libc' as the library, use FFI::Library::LIBC On linux, /usr/lib/libc.so is a linker script, not a library. (you have to use libc.so.6, which is what FFI::Library::LIBC will be on linux) If thats in an example on the wiki, please correct it, or if its in the source tree, report and issue with a patch for it.
No, wiki says this: http://wiki.github.com/ffi/ffi/basic-usage module Hello extend FFI::Library ffi_lib LIBC attach_function 'puts', [ :string ], :int end Hello.puts("Hello, World") But LIBC is not defined in that context, better be explicit: ffi_lib FFI::Library::LIBC Works even on Windows ;-) ruby -v t.rb ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] Hello, World-- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exupéry