This is an example C extension that accompanies the Gems with Extensions guide on http://guides.rubygems.org.
To compile and test the extension:
gem install rake-compiler
rake
This example gem contains comments that are not present in the guide that would be distracting if mixed in with the guide text. I recommend you at least glance through each of the four files in the gem.