Subject: [ruby-ffi] Re: Unsure how to proceed using type defined in header |
From: Wayne Meissner |
Date: 2/21/12 6:24 PM |
To: ruby-ffi@googlegroups.com |
Hi all,I'm in the process of porting the rpam gem over to FFI (I ported the gem from 1.8 to 1.9 a while back, this seemed like the logical next step). One thing I'm having trouble finding documentation on is handling user-defined types from the header when the type being aliased is private to the library.So for instance, in security/pam_appl.h, we have:/** This is a blind structure; users aren't allowed to see inside a* pam_handle_t, so we don't define struct _pam_handle here. This is* defined in a file private to the PAM library. (i.e., it's private* to PAM service modules, too!)*/typedef struct _pam_handle pam_handle_t;My first guess is to define a class inheriting from FFI::Struct, but since I don't know its layout, I'm not sure how to proceed.In the C version, it gets initialized as a null pointer, so I then thought I could do `typdef :pointer, :pam_handle_t`, but this also seems wrong.Grateful for any suggestions.Thanks,
Jason Lewis
Email jasonlewis.x@gmail.com