Subject: Re: [ruby-ffi] Cast null to an undeclared struct when calling a function |
From: Alvaro |
Date: 12/29/10 10:45 AM |
To: ruby-ffi@googlegroups.com |
2010/12/28 Wayne Meissner <wmeissner@gmail.com>:
<zevarito@gmail.com> wrote:On 29 December 2010 06:56, AlvaroHi, I have this scenario: UserInfo *user_info = CloneUserInfo((UserInfo *) NULL); DoSomethingWithUserInfo(user_info) I wonder to know if is possible to cast to UserInfo without having to declare the struct from ruby side since I am actually not going to useJust declare the function as taking a :pointer parameter, then pass nil as the argument e.g. module Foo attach_function :CloneUserInfo, [ :pointer ], :pointer attach_function :DoSomethingWithUserInfo, [ :pointer ], :void end user_info = Foo.CloneUserInfo(nil) Foo.DoSomethingWithUserInfo(user_info)
Thanks!, that works.-- Alvaro