Rb_require causes segfault

Hi,
I have the following code:
#include “ruby.h”

int main(int argc, char* argv[]) {
ruby_init();
ruby_init_loadpath();
rb_require(“socket.so”);

    return 0;

}
When I run it, a get:
ruby: [BUG] Segmentation fault
ruby 1.6.7 (2002-03-01) [i586-linux]
Aborted

What am I doing wrong? I’m getting desperate!

Regards,
Radu

This e-mail was scanned by RAV AntiVirus!

···

Xnet scaneaza automat toate mesajele impotriva virusilor folosind RAV AntiVirus.
Xnet automatically scans all messages for viruses using RAV AntiVirus.

Nota: RAV AntiVirus poate sa nu detecteze toti virusii noi sau toate variantele lor. Va rugam sa luati in considerare ca exista un risc de fiecare data cand deschideti fisiere atasate si ca MobiFon nu este responsabila pentru nici un prejudiciu cauzat de virusi.
Disclaimer: RAV AntiVirus may not be able to detect all new viruses and variants. Please be aware that there is a risk involved whenever opening e-mail attachments to your computer and that MobiFon is not responsible for any damages caused by viruses.

What am I doing wrong? I'm getting desperate!

You have forgotten the flag -rdynamic if you work on linux

Guy Decoux

Is that the same with -fPIC?

ts wrote:

···

“R” == Radu M =?iso-8859-1?b?T2JhZOM=?= writes:

What am I doing wrong? I’m getting desperate!

You have forgotten the flag -rdynamic if you work on linux

Guy Decoux


Wai-Sun “Squidster” Chia
RHCE/Professional Services
Linux/Unix/Web Developer Dude

Is that the same with -fPIC?

No, I don't think, -rdynamic
   a) force the allocation of the global symbol table
   b) cause the inclusion of the global symbols in that table

on linux it add the flag -export-dynamic for ld

Guy Decoux