# Pickaxe ruby extension example

**URL:** <https://www.ruby-forum.com/t/pickaxe-ruby-extension-example/107439>\
**Category:** Ruby\
**Created:** [June 21, 2007, 9:25pm UTC](https://www.ruby-forum.com/t/pickaxe-ruby-extension-example/107439 "2007-06-21T21:25:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [June 21, 2007, 9:25pm UTC](https://www.ruby-forum.com/t/pickaxe-ruby-extension-example/107439/1 "2007-06-21T21:25:58Z")

</div>

Strange, I had the extension working a while ago from the pickaxe book.  
Now when I run the extconf.rb and make I get some errors… any ideas?

EX:

```auto
#include "ruby.h"
static int id_push;
static VALUE t_init(VALUE self)
{
  VALUE arr;
  arr = rb_ary_new();
  rb_iv_set(self, "@arr", arr);
  return self;
}

static VALUE t_add(VALUE self, VALUE obj)
{
  VALUE arr;
  arr = rb_iv_get(self, "@arr");
  rb_funcall(arr, id_push, 1, obj);
  return arr;
}

VALUE cTest;
void Init_my_test()
{
  cTest = rb_define_class("MyTest",rb_cObject);
  rb_define_method(cTest, "initialize", t_init, 0);
  rb_define_method(cTest, "add", t_add, 1);
  id_push = rb_intern("push");
}
```

> > ruby extconf.rb  
> > make  
> > gcc -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.8.2  
> > -I/usr/local/lib/ruby/1.8/i686-darwin8.8.2 -I. -fno-common -g -O2  
> > -fno-common -fno-common -pipe -fno-common -c my\_test.c  
> > cc -dynamic -bundle -undefined suppress -flat\_namespace  
> > -L"/usr/local/lib" -o my\_test.bundle my\_test.o -lruby -lpthread -ldl  
> > -lobjc  
> > /usr/bin/ld: warning multiple definitions of symbol \_setregid  
> > /usr/local/lib/libruby.dylib(process.o) definition of \_setregid  
> > /usr/lib/gcc/i686-apple-darwin8/4.0.1/…/…/…/libpthread.dylib(setregid.So)  
> > definition of \_setregid  
> > /usr/bin/ld: warning multiple definitions of symbol \_setreuid  
> > /usr/local/lib/libruby.dylib(process.o) definition of \_setreuid  
> > /usr/lib/gcc/i686-apple-darwin8/4.0.1/…/…/…/libpthread.dylib(setreuid.So)  
> > definition of \_setreuid
