Subject:
[ruby-ffi] FFI::ManagedStruct #release method
From:
Levi Wilson
Date:
10/20/13 9:26 PM
To:
ruby-ffi@googlegroups.com

I'm using FFI::ManagedStruct in a project of mine to be sure to clean up my memory. The question I have is around what happens if that call fails. The reason that I ask is because I had renamed the function and forgot to reflect this in the self.release definition. I expected this to raise an exception as my function wasn't defined. Is there a way to make this more obvious to me if this happens again?

class MyManagedStruct < FFI::ManagedStruct
  layout :name, :string,
            :ids, :pointer,
            :ids_length, :int

  def self.release
    MyLibrary.release_my_struct
    # MyLibrary.oops_this_is_not_named_correctly does not fail
  end
end

Thanks in advance,

Levi

--
 
---
You received this message because you are subscribed to the Google Groups "ruby-ffi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-ffi+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.