Subject:
Re: [ruby-ffi] Re: How to declare (int *argc, char *argv)?
From:
Matijs van Zuijlen
Date:
8/21/11 1:17 PM
To:
ruby-ffi@googlegroups.com

Hi przemo_li,

First, did you take a look at https://github.com/remogatto/ffi-opengl? Perhaps you can fork it and go from there?

On 08/20/2011 03:00 PM, przemo_li wrote:
I've read that :pointer can be used as output array of strings.
(int * argc, char ** argv)

Can I use :int, as output int parameter?
[:int, :pointer]

No, both parameters need to be pointers.

So resulats (if I can use :int)
attache_function :glutInit, [:int, :pointer], :void

Then how to change ARGV (array of strings) so it can be passed
as :pointer?

For an example of processing ARGC and ARGV, see:

https://github.com/mvz/ruby-gir-ffi/blob/master/examples/hard_coded.rb

(Oh, and note that ARGV on ruby doesn't include the name of the executable, but C functions generally expect that it does).

HTH,
-- 
Matijs