From: ptkwt@... (Phil Tomson) Date: 2004-10-31T03:23:55+09:00 Subject: Re: embedding, 'require' and extensions In article <200410301010.i9UAAFP29889@moulon.inra.fr>, ts wrote: >>>>>> "P" == Phil Tomson writes: > >P> Here is the relevant part of the C-side code: > > You don't give the most important part : how do you build your > executable ? > > You must use the value given in rbconfig.rb to build the command line, in > your case you've probably forgotten -rdynamic when you have compiled your > source. Here's how I built: $ gcc -I/usr/local/lib/ruby/1.8/i686-linux -g -c -o summer.o summer.c $ gcc -o summer summer.o -L/usr/local/lib/ruby/1.8/i686-linux -lruby-static -ldl -lm -lcrypt -rdynamic It didn't make any difference if I used rdynamic or not. > > Another thing > >P> rb_require("sum.rb"); //ruby script is sum.rb > > You *must* protect any call to a ruby function which can generate an > error, with rb_protect(), otherwise ruby will crash > Yes, I know. I was only doing a quick/small test before adding more. Phil