#include <ruby.h>

/* Add integers v1 and v2 and return the result */
static VALUE add(VALUE self, VALUE v1, VALUE v2)
{
  /* Convert our arguments */
  int i1 = NUM2INT(v1);
  int i2 = NUM2INT(v2);

  /* Do the math */
  int result = i1 + i2;

  /* Convert and return the result */
  return INT2NUM(result);
}

/* Initialize the library */
void Init_add()
{
  rb_define_global_function("add", add, 2);
}

