Kyle Schmitt
3/18/2008 7:03:00 PM
Not having done this, this is a shot in the dark, but....
First thing to do, is to see if you can use compiled ruby extensions
from a plain old c program.
Pick a common compiled ruby lib, and try and link to it. Maybe
digest.so? I'm pretty sure you can get this to work, but I've never
tried.
Now...
There are several systems out there to make it easier for you to
develop ruby code, and turn it into a c extension for ruby: rubyinline
and ruby2c come to mind (ruby2c may be slightly abandoned, but it
could still help).
This is the only way that comes to my mind to do what you want to do...
Write your library in pure ruby
Write a really good set of unit tests!
Use those tools to piecewise convert the library to a purely C ruby extension
Make sure those unit tests still pass...
Link to that extension (probably libruby too) from your C program.
--Kyle
On Mon, Mar 17, 2008 at 6:54 AM, Pavel Smerk <smerk@fi.muni.cz> wrote:
> Hello *,
>
> is there any possibility to build an unix library not from C/C++/...
> code, but from ruby code? IOW, I need to have some functionality
> "packaged" as an unix library, but I'd like to write it in Ruby and
> then, somehow, compile it. Is it possible?
>
> Thanks,
>
> P.
>
>