Fwd: Ruby FFI port

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.

-Charles

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.

-Charles

On Sun, Mar 27, 2011 at 6:28 PM, Charles S. <

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…

D’oh! I overlooked the
UnmanagedFunctionPointerAttributehttp://msdn.microsoft.com/en-us/library/system.runtime.interopservices.unmanagedfunctionpointerattribute.aspx
.

-Charles

On Thu, Mar 31, 2011 at 4:41 AM, Charles S. <

Ryan,

I’m absolutely interested, but, as much as it shames me to say, the
ALT.NET Seattle conference wasn’t on my radar until just now.

I’m down for next year though, especially if you plan to give an F#
workshop.

-Charles

Are you coming to ALT.NET Seattle? We have an OSS track this year to
help people learn how to contribute to projects. Interested?

Ryan

Sent from my iPhone

All,

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.

-Charles

On Thu, Mar 31, 2011 at 5:00 AM, Charles S. <

That’s a possibility, but it might have to come further down the road.

-Charles

I’ll need just another week or two to cut the first release.

Maybe it can merge with mainline ffi gem at some point?
-r

I just wanted to check how the Ruby FFI library was coming along?