Subject:
Re: [ruby-ffi] Re: Link to non-windows dlls
From:
Kevin Vanden Berge
Date:
10/23/10 10:33 AM
To:
ruby-ffi@googlegroups.com

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.

On Sat, Oct 23, 2010 at 11:25 AM, Luis Lavena <luislavena@gmail.com> wrote:
On Sat, Oct 23, 2010 at 12:18 PM, kvberge <kvandenberge@gmail.com> wrote:
> I can provide the c declarations to the functions I am attempting to
> wrap, but I cannot provide the dll because it is a dll for the company
> I work for and I am not allowed to supply the dll.
>

Since I can't test it, why are you sending a :pointer instead of :string?

In the C definition Send expects a string, but you're using a pointer
and not using FFI MemoryPointers to handle it.

Also, will be great to know in which Ruby line the project segfault,
guess could be based on what I'm saying above.

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