I'm new to both Linux (I unfortunately abandoned BeOS) and Ruby, so I
might be overlooking something simple, but here's my problem. I cannot
write even the simplest extension in C that I can load into a Ruby
program. I started with a real program, but I've whittled it down to
these barebones:
My C source: test.c
--------------------
#include "ruby.h"
VALUE cTest;
void Init_Test()
{
cTest = rb_define_class("Test", rb_cObject);
}
With this as my extconf.rb:
----------------------------
require 'mkmf'
create_makefile("testlib")
Testing with this Ruby source: test.rb
-------------------------------
require 'testlib'
puts "Hello world!"
When I execute "ruby test.rb" after (successful) making, I get
test.rb:1:in `require': (null) - ./testlib.so (LoadError)
from test.rb:1
Running "ldd testlib.so" gives
libc.so.6 => /lib/libc.so.6 (0x40011000)
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1 (0x40124000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)
so the library seems ok. What's going on? I've tried Ruby 1.64 plus
the CVS sources I grabbed last night. I've also tried both gcc 2.95.2
and 3.0. No luck.
Thanks in advance,
Ryan