Subject: [ruby-ffi] Re: attach_function syntax when input args are pointers to contain return values |
From: Wayne Meissner |
Date: 1/31/13 5:12 PM |
To: ruby-ffi@googlegroups.com |
Hi,My guess is that this has been asked before, but I didn't find it...not exactly sure what to search for...Anyway, I am trying to attach functions that return :void but use the input parameters to hold the return values. e.g. A function that gets a value and returns it as a string and length. So say my C-function declaration is:void GetMyString(const long reference, char *buffer, int *size)My guess, and I'm sure it doesn't work because I tried it, was to do:buffer = FFI::MemoryPointer.new(:char, 256)size = FFI::MemoryPointer.new(:int,1)attach_function :GetMyString, [ :long, buffer, size ], :voidI got a "can't resolve type" error when I tried that.What's the correct way to do it?Thanks,Rob