From: Eric Hodel Date: 2005-03-24T04:48:20+09:00 Subject: Re: Stack, Struct and DL --Apple-Mail-12-156090484 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 23 Mar 2005, at 08:49, Luc Heinrich wrote: > Greetings, > > Suppose that I have the following C code: > > typedef struct FOO > { > int bar; > int baz; > }; > > FOO make_a_foo( void ) > { > FOO foo; > foo.bar = 42; > foo.baz = 1; > > return foo; > } > > I'm struggling to find the correct way (if it's even possible) to get > my > hands on the struct returned by 'make_a_foo', using ruby/dl. > > I smell some troubles. I had just this problem a few days ago [ruby-talk:134052]. Takaaki Tateishi had the solution in [ruby-talk:134057]. module Stuff FOO = struct [ "int bar", "int baz" ] extern "FOO make_a_foo(void)" def my_make_a_foo return FOO.new(make_a_foo) end end I think. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Apple-Mail-12-156090484 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCQcfsMypVHHlsnwQRAvgwAJ9g/pSNcBvV6v2GqpqRqissr3mf8ACgudo0 JrXSXSCc+kLPtT6R/uPQSzc= =+WOb -----END PGP SIGNATURE----- --Apple-Mail-12-156090484--