From: Jason Roelofs Date: 2008-03-17T22:43:50+09:00 Subject: Re: How to make an unix library from some ruby code? Pavel, perlembed is about embedding Perl into your programs, not libraries and even then it's about building a C / C++ program that can call out perl functions, like for using Perl as a scripting language. If you want a library that's linked to by other programs, it has to be written in a language that can be compiled into a static library. Thus, you're stuck with C / C++. What you want, you can't do, whether in Ruby, Perl, Lua, etc. You can fake it by: Creating a C library with a single function that starts up the Ruby vm and executes installed Ruby scripts or Ruby code compiled into the library as a giant string. Link to that library, link to Ruby, and then call the function to start the whole process. Please don't do this. If it needs to be a Unix library, just write it in C / C++. Jason On Mon, Mar 17, 2008 at 9:24 AM, Pavel Smerk wrote: > Marc Heiler wrote: > >> I need to have some functionality "packaged" as an unix library > > Just write the ruby code or use what is already available. > > Ruby can do the same what the unix tools can. Its just a question of > > how much work to invest :-) > > Unfortunately, I definitely need a library which could be easily used in > C programs (or elsewhere). A ruby script does not fit my needs. > > Because it is possible to embed Perl interpreter to a C program (man > perlembed, http://perldoc.perl.org/perlembed.html), I believe there > could be something similar in Ruby. > > Thanks, P. > >