Rb_io_getline question

Hi:

I am experimenting with some of the C io routines for the first
time and am getting a relocation error in rb_io_getline.

The C code is:

static VALUE
ff_cloop(self, infptr)
VALUE self, infptr;
{
VALUE str = Qnil;
VALUE rs = rb_str_new2("\n"); // Is this correct?
str = rb_io_getline(rs, infptr); // This line is causing the err
return Qnil;
}

The error I get is:
ld.so.1: /tools/apps/ruby/ruby-1.8.0/bin/ruby: fatal: relocation error:
file ./fastfile.so: symbol rb_io_getline: referenced symbol not found
Killed

And the ruby driver code is:

require 'fastfile’
file = ARGV.shift
ff = FastFile.new

File.open(file) { |f|
ff.cloop(f)
}

Can someone help me out here?
Thanks

···


Jim Freeze

I just forgot my whole philosophy of life!!!

      VALUE rs = rb_str_new2("\n"); // Is this correct?
      str = rb_io_getline(rs, infptr); // This line is causing the err

         str = rb_io_gets(infptr);

      return Qnil;
  }

The error I get is:
ld.so.1: /tools/apps/ruby/ruby-1.8.0/bin/ruby: fatal: relocation error:
file ./fastfile.so: symbol rb_io_getline: referenced symbol not found
Killed

rb_io_getline is a static function

Guy Decoux

Hmm, can you translate that? Does that mean it can’t be used or
that it needs to called differently (and if so, how)?

···

On Friday, 11 April 2003 at 21:19:39 +0900, ts wrote:

  VALUE rs = rb_str_new2("\n");    // Is this correct?
  str = rb_io_getline(rs, infptr); // This line is causing the err
     str = rb_io_gets(infptr);
  return Qnil;

}

The error I get is:
ld.so.1: /tools/apps/ruby/ruby-1.8.0/bin/ruby: fatal: relocation error:
file ./fastfile.so: symbol rb_io_getline: referenced symbol not found
Killed

rb_io_getline is a static function


Jim Freeze

“I drink to make other people interesting.”
– George Jean Nathan

Hmm, can you translate that? Does that mean it can't be used or
that it needs to called differently (and if so, how)?

you can't use rb_io_getline() but rb_io_gets() do what you want if the
record separator is '\n'

Guy Decoux

Jim Freeze wrote:

···

On Friday, 11 April 2003 at 21:19:39 +0900, ts wrote:

rb_io_getline is a static function

Hmm, can you translate that? Does that mean it can’t be used or
that it needs to called differently (and if so, how)?

It means that the function is “private” and only available to the file
in which it is defined. Whether there’s a way around this I’m not sure,
so I’ll let Guy pick it up from here. :slight_smile:


Jason Voegele
“There is an essential core at the center of each man and woman that
remains unaltered no matter how life’s externals may be transformed
or recombined. But it’s smaller than we think.”
– Gene Wolfe, The Book of the Long Sun

Thanks. Is it the same for rb_io_getline_fast?

···

On Friday, 11 April 2003 at 21:41:45 +0900, ts wrote:

Hmm, can you translate that? Does that mean it can’t be used or
that it needs to called differently (and if so, how)?

you can’t use rb_io_getline() but rb_io_gets() do what you want if the
record separator is ‘\n’


Jim Freeze

The older a man gets, the farther he had to walk to school as a boy.

Thanks. Is it the same for rb_io_getline_fast?

Yes, rb_io_getline_fast is a static function

rb_io_gets(VALUE) is the same than rb_io_getline_fast(OpenFile *, '\n')

Guy Decoux