Having written the source code for an extension, we now need to compile
it so Ruby can use it. We can either do this as a shared
object, which is dynamically loaded at runtime, or statically link
the extension into the main Ruby interpreter itself. The basic
procedure is the same:
- Create the C source code file(s) in a given directory.
- Create
extconf.rb
.
- Run
extconf.rb
to create a Makefile
for the C files in
this directory.
- Run
make
.
- Run
make install
.