<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>klaasprause.com &#187; JRuby</title>
	<atom:link href="http://klaasprause.com/category/ruby/jruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://klaasprause.com</link>
	<description>Klaas' personal site</description>
	<lastBuildDate>Tue, 25 Jan 2011 08:50:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JRuby access to C libraries using FFI</title>
		<link>http://klaasprause.com/2008/09/02/jruby-access-to-c-libraries-using-ffi/</link>
		<comments>http://klaasprause.com/2008/09/02/jruby-access-to-c-libraries-using-ffi/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 09:59:53 +0000</pubDate>
		<dc:creator>Klaas</dc:creator>
				<category><![CDATA[JRuby]]></category>
		<category><![CDATA[jruby ffi rubinius]]></category>

		<guid isPermaLink="false">http://klaasprause.com/?p=19</guid>
		<description><![CDATA[With the new release of JRuby 1.1.4 it is possible to use the rubinius FFI API. With FFI you can access C libraries via plain ruby code. To get started with FFI the only documentation I have found is provided by Free Minds blog entry. Additional info may be posted to the discussion using jruby-ff. [...]]]></description>
			<content:encoded><![CDATA[<p>With the new release of <a href="http://docs.codehaus.org/display/JRUBY/2008/08/28/JRuby+1.1.4+Released">JRuby 1.1.4</a> it is possible to use the <a href="http://rubini.us">rubinius</a> FFI API. With FFI you can access C libraries via plain ruby code. To get started with FFI the only documentation I have found is provided by <a title="On the Rubinus FFI" href="http://pluskid.lifegoo.com/?p=370">Free Minds</a> blog entry. Additional info may be posted to the discussion <a href="http://www.nabble.com/Using-jruby-ffi-td18775932.html">using jruby-ff</a>. Hopefully gem authors start to implement extensions with FFI besides their native extensions to make it possible to use the gem with Rubinius and JRuby.</p>
<p>One problem is to provide ruby callback functions for the C library. I am trying to figure out how to extend <a href="http://sqlite-ruby.rubyforge.org/sqlite3/">sqlite3-ruby</a> to work with jruby. Sqlite3-ruby uses <a href="http://www.swig.org/Doc1.3/Ruby.html">swig</a> to create a native binding to the sqlite3 library. Within driver.rb some callbacks are registered for the C code like:</p>
<p><code>API.sqlite3_busy_handler( db, API::Sqlite3_ruby_busy_handler, cb )</code></p>
<p><em><code>API::Sqlite3_ruby_busy_handler</code></em><code> </code>is a callback implemented in the native extension. FFI does not provide any support for callbacks. To support C APIs that use callbacks a workaround must be found.</p>
]]></content:encoded>
			<wfw:commentRss>http://klaasprause.com/2008/09/02/jruby-access-to-c-libraries-using-ffi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

