Takaaki Tateishi wrote:
> Please use the method 'struct' like 'extern', and the following example
> shows how to use it.
> 
> 
> require 'dl/import'
> require 'dl/struct'
> 
> module MyLIB
>   extend DL::Importable
> 
>   MyStruct = struct [
>     "int foo[3]",
>   ]
> end
> 
> ptr = MyLIB::MyStruct.malloc()
> ptr.foo = [0,1,2]
> p ptr.foo
> 
> 
> But I found a bug on 'dl/struct.rb', so please replace it with the 
> following file.
> http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/~checkout~/ruby/ext/dl/lib/dl/struct.rb?rev=1.8.2.4;content-type=text%2Fplain;only_with_tag=ruby_1_8 

Thanks so much for your help Takaaki,

Do you know the answer to the other question?  How to wrap a function 
that modifies a structure you pass in?

For example:

#define VALID_DATA 1
#define ERROR 0

int get_data(struct mystruct *data_ptr)
{
   if (error_happened())
   {
     return ERROR;
   }
   else
   {
     data_ptr->foo[0] = 0;
     data_ptr->foo[1] = 0xFF;
   }
}


How do I write Ruby/DL code that uses this function to get data out of 
data_ptr?

I noticed that when using the Ruby/DL Symbols, calls like atoi["1"] 
returns two things, the result and the args.  Would these args contain 
the modified structure?

The type of function I want to access from Ruby is "scanf" type 
functions where the return value isn't the only data returned.

Thanks,

Ben