Our hero finds a useful companion after having escaped the first part of the wild maze he got himself into last time.
This is part 4 of my exploits in Ruby C extension land.
If you haven't read part 1, 2 and 3, you might want to go back there.
After having surmounted the first obstacles, I found myself facing a small cottage that turned out to be inhabited by a nice young fellow, called Luis.
I told him my story and that I wanted to seek the miracles of this magic land and he empathized with me.
Being totally enchanted by my tale, he agreed to lend me his mighty steed for my exploits.
When using the steed -- I mean rake-compiler -- there are some simple steps you need to take.
First, you must modify your Rakefile:
require 'rake/extensiontask' Rake::ExtensionTask.new('cranberry', $gemspec)
cranberry with the name of the
ext directory from the last part.
(NOTE: I'll write an extra article on integrating Jeweler and rake-compiler .)
Once you have done that, there are several new tasks available for you:
rake compile # compile all defined extensions rake compile:cranberry # compile the cranberry extension rake native # prepare for native gem build
The last one can be used like one of the following:
rake native gem rake native build
depending on your rake configuration (for jeweller it's the last one).
Now you're ready to compile some C!
Just put some example C code in the
ext directory and run
the above tasks.
While you do that, I'll go off and ponder on what to tell you next.