Can RoR call java or C code


#1

Hi
I posted this a while back but it has not yet showed up. I dont know
what happened last time… so posting again

  1. Can RoR call C or java third party code?
  2. Does it support File I/O ?

thanks
Rupak


#2

You can write extensions to the Ruby language in C to call third-party
code. RoR itself does not provide any such facilities.

You could take a look at the JRuby project. This allows Ruby to run on
top of the JVM and provides full access to the Java platform. It is not
currently mature enough to support RoR unfortunately. :frowning:


#3

P.S. RoR does support file I/O - but only on the server of course.


#4

removed_email_address@domain.invalid wrote:

This might help:
http://www.rubyinside.com/writing-your-own-ruby-extension-with-c-366.html


#5
  1. Can RoR call C or java third party code?

Yes. Both. Those aren’t really features of RoR but of Ruby. There
is a whole chapter in the Pickaxe book about extending Ruby with C.
As for Java, try RJB the Ruby Java Bridge. In fact I just wrote a RoR
project that uses itext, a java library, via RJB. It worked very
well.

  1. Does it support File I/O ?

Of course.


#6

On Jan 27, 7:22 am, Mick S. removed_email_address@domain.invalid
wrote:

You can write extensions to the Ruby language in C to call third-party
code. RoR itself does not provide any such facilities.

You could take a look at theJRubyproject. This allows Ruby to run on
top of the JVM and provides full access to the Java platform. It is not
currently mature enough to support RoR unfortunately. :frowning:

Actually JRuby does run RoR right now, but with caveats (known issues)
and it’s better at 1.1.6. However we’ve been demoing basic Rails 1.2.1
apps running under JRuby almost weekly, and we’re making a major push
over the next month to cleanup all the remaining failures.

  • Charlie