[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

pickaxe ruby extension example.

warhero

6/21/2007 7:26:00 PM

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:
[code]
#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");
}
[/code]

>>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

--
Posted via http://www.ruby-....