Subject:
Re: [ruby-ffi] Re: Link to non-windows dlls
From:
Luis Lavena
Date:
10/23/10 10:41 AM
To:
ruby-ffi@googlegroups.com

On Sat, Oct 23, 2010 at 12:33 PM, Kevin Vanden Berge
<kvandenberge@gmail.com> wrote:
> The SegFault occurs when I put the call of UsbLibrary.Receive(a,1000) in the
> test_usb.rb script.  Changing the Send parameter from :pointer to :string
> has no effect on the outcome.  As for why I did pointer instead of string, I
> have no good reason except that I saw an example of a wrapper to a C
> function that had a char* as parameter and it was done using :string and
> then another example showed it using :pointer another time.
>

For you to receive in a pointer you need to allocate memory for that buffer.

http://github.com/ffi/ffi/wiki/Pointers

-- 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