From: Charles Oliver Nutter Date: 2008-11-11T13:52:44+09:00 Subject: Re: [ANN] FFI 0.1.1 (Foreign Function Interface) for Ruby 1.8.6/7 and 1.9 Clifford Heath wrote: > Charles Oliver Nutter wrote: >> Actually structs are already supported! > > Sorry if you see this twice, posting difficulties. > > I'm having a bash at wrapping freetds. This library > has a Context struct which contains three callback > function pointers. POLS says these should look like > this: > > callback :handle_message, [ :pointer, :pointer, :pointer ], :in # > TDSCONTEXT, TSSSOCKET, TDSMESSAGE > callback :handle_int, [ :pointer ], :in # void* > > class Context < FFI:Struct > layout \ > :locale, :pointer, 0, # TDSLOCALE > :parent, :pointer, 4, # void * > :msg_handler, :handle_message, 8, # callback(TDSCONTEXT, > TDSSOCKET, TDSMESSAGE) > :err_handler, :handle_message, 12, # callback(TDSCONTEXT, > TDSSOCKET, TDSMESSAGE) > :int_handler, :handle_int, 16 # callback(void*) > end > Am I on the right track, or is this not possible yet? There's no support at the moment for callbacks-in-structs, but it's just a bug report (and ideally a patch) away :) http://kenai.com/projects/ruby-ffi - Charlie