Subject: Re: [ruby-ffi] Problem with AutoPointer and ManagedStruct |
From: Wayne Meissner |
Date: 12/9/10 2:24 PM |
To: ruby-ffi@googlegroups.com |
On 10 December 2010 00:36, zenChild <dan.wanek@gmail.com> wrote:
# --------- Example One --------- class GssBufferDesc < FFI::Struct layout :length => :size_t, :value => :pointer # pointer of :void end
output_token = FFI::MemoryPointer.new :pointer maj_stat = LibGSSAPI.gss_init_sec_context(..., output_token, ...) LibGSSAPI::GssBufferT.new(output_token.get_pointer(0))
I suspect what you're passing in as output_token is the problem. Do the same as you were in example One - allocate a GssBufferDesc and use it as output_token, then construct the AutoPointer using its :value field as the pointer. e.g. output_token = GssBufferDesc.new maj_stat = LibGSSAPI.gss_init_sec_context(..., output_token, ...) LibGSSAPI::GssBufferT.new(output_token[:value])