wayne: (so now I know the story behind all those issues you raised against JRuby)
Hehe, yes. I wanted to see if I could run some MRI-working code (spotify gem + OpenAL) on JRuby,
and in doing that I ran into a few issues. The reason for doing that was because I became curious as
I was writing the article. I’m happy to say I managed to get it running on JRuby, streaming music from
the spotify API, bound with FFI, into the OpenAL API, bound with FFI. Really cool!
postmodern: all of the other blog posts only cover loading a library and attaching some functions.
Yes. I have not yet found a blog post that explains the basics better than the wiki though. The wiki is
a nice collection of information, and it was pretty much my bible when I started with FFI, together with
the FFI source code. I believe there is place for yet another article on FFI, aimed at people beginning
with FFI for the first time.
wayne: Any subclass of FFI::AutoPointer can be used as a function result, and it automatically wraps the result of the function in that AutoPointer subclass.
This is a really nice way of using FFI, and I actually do this throughout all one of my FFI gems. The
spotify library in particular uses a reference counting mechanism, where some functions return pointers
that should have their reference increased, and I do that automatically with a similar mechanic to .auto_ptr:
4) Completely replace the FFI api with your own concoction. Using FFI::DynamicLibrary, FFI::Function, and FFI::DataConverter, you can write your own API for mapping C libraries into ruby. Thats how JRuby implements legacy interfaces like dl and Win32API.
I did not know you could do that. Nice!
— Kim
--
---
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.