From: Park Heesob Date: 2006-06-08T19:00:56+09:00 Subject: Re: using an inout parameter from a DLL Hi, >From: Xavier Noria >Reply-To: ruby-talk@ruby-lang.org >To: ruby-talk@ruby-lang.org (ruby-talk ML) >CC: Ana Isabel L?ez >Subject: using an inout parameter from a DLL >Date: Thu, 8 Jun 2006 18:12:19 +0900 > >I have to call a function in a DLL using the dl library. > >That function returns a status value and has a pointer to long as inout >parameter to return a value if successful. How do I declare that type? How >do I pass that parameter? How do I read the value pointed to? > >-- fxn > > A little ugly but this works: msg = DL.dlopen("dlltest.dll") @func= msg["Func", "IL"] in_value = 123 ptr = [in_value].pack('L') a = @func.call( [ptr].pack("P").unpack('L').first ) out_value = ptr.unpack('L').first Regards, Park Heesob