You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We really should have a better set of examples and documents for how to write a JRuby extension. Many folks could be creating high-performance extensions to JRuby if this information were available.
The most recent article on writing an extension appears to be one from @jcoglan:
The "service" model of getting the code to load has largely (but unofficially) been deprecated in favor of simply using Java integration to boot up the extension directly, as seen in JRuby's OpenSSL ruby bits:
# Attempt to load the gem firstbeginrequire'jruby-openssl'rescueLoadError# Not available, use built-inrequire'bouncy-castle-java'require'jopenssl.jar'org.jruby.ext.openssl.OSSLLibrary.new.load(JRuby.runtime,false)
...
But otherwise, we do have several good examples of how to write extensions.
A few current extensions that would be good models:
The weakling gem implements a more reliable weakref for (J)Ruby.
The psych gem will soon incorporate JRuby's extension alongside the C extension. It provides a very good model of how to write a minimal Java-based extension that you wire up and provide a nice API for in Ruby.
The text was updated successfully, but these errors were encountered:
Also, https://github.com/relevance/diametric, ActiveRecord wrapper for Datomic, is a Java extension and supports CRuby (CRuby API is really limited). Although the code is in master, it's not yet released.
Every time I use JRuby's internal API, I think I need "GreenBridge" (Tom talked about a while ago) for those of who write Java extensions including me. Especially, when a method signature is different depends on CompatVersion, I think it's better to have Java side API for such method.
I will happily correct my blog post and the codebase it's based on (now faye/websocket-driver-ruby) if someone shows me what I should be doing instead. I was quite confused at the time and that was the first thing I got to work.
There's a sample project, articles, and wiki stuff out there now. We need better linkage between our docs, but since this has been around a long time I'm closing it.
We really should have a better set of examples and documents for how to write a JRuby extension. Many folks could be creating high-performance extensions to JRuby if this information were available.
The most recent article on writing an extension appears to be one from @jcoglan:
http://blog.jcoglan.com/2012/08/02/your-first-ruby-native-extension-java/
The "service" model of getting the code to load has largely (but unofficially) been deprecated in favor of simply using Java integration to boot up the extension directly, as seen in JRuby's OpenSSL ruby bits:
But otherwise, we do have several good examples of how to write extensions.
A few current extensions that would be good models:
The text was updated successfully, but these errors were encountered: