Subject: Re: [ruby-ffi] A really simple example: Segmentation fault |
From: Jesús García Sáez <blaxter@gmail.com> |
Date: 2/1/10 1:57 AM |
To: ruby-ffi@googlegroups.com |
On Mon, Feb 1, 2010 at 01:33, Wayne Meissner <wmeissner@gmail.com> wrote:
<blaxter@gmail.com> wrote:On 1 February 2010 05:39, Jesús GS$ more example.rb require 'rubygems' require 'ffi'
extend FFI::Library ffi_lib './libsample.so' attach_function :foo, :foo, [:int], :intYou need to enclose the above in a module. e.g. module LibSample extend FFI::Library fi_lib './libsample.so' attach_function :foo, :foo, [:int], :int end And call it as LibSample.foo(1)
That's right, thank you so much Wayne :)