Well, I think I’ve made a little progress - hoping to attach a simple
function soon.
I am concerned about one thing though - we need to be able to call
function
pointers, but I think that Marshal.GetDelegateForFunctionPointer only
supports the STD calling convention. Any thoughts on how we might
support
cdecl? Presently, it’s not a blocking concern - so I’ll cross that
bridge
when the time comes…
Wayne: Sorry - I meant to send that to the mailing list, as opposed to
sending it directly to you.
Well, with some really, *really *ugly hacking, I’ve managed to get this
far
(the first example from FFI wiki):
irb(main):011:0> module Hello
irb(main):012:1> extend FFI::Library
irb(main):013:1> ffi_lib FFI::Library::LIBC
irb(main):014:1> attach_function ‘puts’, [ :string ], :int
irb(main):015:1> end (Object doesn’t support #inspect)
=>
irb(main):016:0> Hello.puts(“Hello, World”)
Hello, World
=> 0
(dunno why that “(Object doesn’t support #inspect)” shows up…)
Anywho, I think we might might have a significant portion of FFI
implemented
fairly soon. The codebase is still pretty unstable/crappy, but I’m
hoping
to get it ready for contributions soon.
I am concerned about one thing though - we need to be able to call function
pointers, but I think that Marshal.GetDelegateForFunctionPointer only
supports the STD calling convention. Any thoughts on how we might support
cdecl? Presently, it’s not a blocking concern - so I’ll cross that bridge
when the time comes…
IronRuby FFI is coming along well. So far, I support most of the
FFI::Function uses, including attaching to function pointers, library
functions, and wrapping Procs.
Structs are at 50%, and callbacks need to be implemented.
I’ll need just another week or two to cut the first release.