From: Takaaki Tateishi Date: 2005-02-03T23:52:14+09:00 Subject: Re: Ruby/DL and functions that modify a pointer Ben Giddings wrote: > Something like this works for the 'timeval' struct, but I don't know how > to use it with structs containing arrays. 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 -- Takaaki Tateishi