--mPTHnM80CEnHQ2WJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Have you read the Extending Ruby chapter Programming Ruby? There are a few examples in there that you could begin to work with. -sc http://www.rubycentral.com/book/ext_ruby.html > 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. -- Sean Chittenden --mPTHnM80CEnHQ2WJ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Comment: Sean Chittenden <sean / chittenden.org> iEUEARECAAYFAjtZC14ACgkQn09c7x7d+q2hQQCeL6AXGpQvCQ0U91UU5dj6rnIn 0vcAmJGSQ21jld2f9R6yaZ7kRLMakyM IC -----END PGP SIGNATURE----- --mPTHnM80CEnHQ2WJ--