From: Ben Giddings Date: 2005-02-05T05:48:30+09:00 Subject: Re: Ruby/DL and functions that modify a pointer Takaaki Tateishi wrote: >> Do you know the answer to the other question? How to wrap a function >> that modifies a structure you pass in? > > > Just use 'extern' as follows: > > module MyLIB > extend Importable > dlload "...." > MyStruct = struct [ > "int foo[3]", > ] > extern "int get_data(void*)" > end > > ptr = MyLIB::MyStruct.malloc() > MyLIB.get_data(ptr) Thanks so much Takaaki, that works perfectly, I'm now wrapping a library and doing some pretty impressive things, all in less than 100 lines of Ruby code! Ben