Subject: Re: [ruby-ffi] unsigned char * |
From: Chuck Remes |
Date: 2/8/12 12:13 AM |
To: ruby-ffi@googlegroups.com |
On Feb 6, 2012, at 3:15 AM, Jeffrey Jones wrote:
Hello all, I am in the early stages of investigating ruby FFI for use with a particular third party library. This library makes use of a few functions with the following signature. struct * function (unsigned char*, unsigned int) These functions are basically used for reading data in from various places (fread for example) so it is the data itself and the data size. Looking at all the various documentation and examples and code, I cannot actually see what I need to do in ruby to match the signature. module Foo attach_function :function, [:uchar, :uint], :pointer end Doesn't work because it isn't expecting a single char but a char*. Does anyone know what I need to do? (If it is even possible?)
A "char *" is a pointer. You almost had the answer on your own. module Foo attach_function :function, [:pointer, :uint], :pointer end Try that. cr