Strange Behavior

T

Todd Phillips

The problem seems to be in c code calling ruby calling c code.

======== start test.rb
puts "about to require curses"
require "curses"
puts "curses loaded"
======== end test.rb
======== start simple.c
#include "ruby.h"

int main()
{
ruby_init();
ruby_init_loadpath();
rb_require("test.rb");
return 0;
}
======== end simple.c

$ ruby test.rb
about to require curses
curses loaded

$ gcc -o simple -I/usr/lib/ruby/1.6/i386-linux/ simple.c
-L/usr/lib/ruby/1.6/i386-linux/ -lruby -ldl -lcrypt -lm

$ ./simple
about to require curses
../test.rb:2: [BUG] Segmentation fault
ruby 1.6.7 (2002-03-19) [i386-linux]
Aborted



There is nothing special about the curses extension, this happens for any
extensions. I don't know what to do about this, and I'd appreciate any
help beyond the level of "re-install a new version of ruby" since I don't
have control over this distribution.

I've made this work on a Darwin6.6 machine, so I suspect there is some
disagreement between these guys:
$ gcc --version
2.96
$ ruby --version
ruby 1.6.7 (2002-03-19) [i386-linux]

Any ideas would be appreciated.
Thanks,
Todd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top