RubyInline is a Ruby module that allows for easily embedding and on-the-fly compiling C code in Ruby modules. Although it will work right away on most typical situations, there are a couple of catches you should keep in mind: - To minimize startup times, the inlined C code is cached. This means, any user who calls this module in his Ruby code will get a directory called ".ruby_inline" on his home directory. Inside this directory, Inline will store the C code to be compiled and the compiled objects. The directory can be safely purged, as it will be regenerated as needed. - You can set up the environment variable INLINEDIR to specify a different directory, i.e., to cope with the cases where the current user has no rights to write on his own directory (which is often the case when using this module for Web-facing application servers). You can safely point it to a randomized temporary directory, as in: $ su - nobody -c 'export INLINEDIR=$(mktemp -d); \ ruby_inline_using_application; \ rm -rf $INLINEDIR' Of course, you would replace the call to Ruby to the startup for your application. There will be a slight time penalty upon initialization, as this will compile anew the code each time it is started, but will allow you to work with users unable to work in their home directories. - It might also be a good idea, specially on slower systems, to set INLINEDIR to a fixed location, i.e. to create user-owned /var/lib/inline/$(whoami) directories. This would avoid the recompilation penalty - You should just remember to purge the directory should you stop using this module. Of course, for most use cases, the default .ruby_inline directory will serve you well. -- Gunnar Wolf , Mon, 22 Sep 2008 18:16:12 -0500