Strange 'require' side-effects with rubygems

I'm trying to use the ruby-serialport library
(http://rubyforge.org/projects/ruby-serialport/) under Ruby 1.8.2 on Windows
XP, and I ran into some odd behaviour. Perhaps someone here can explain
what's going on.

First, here's a much-elided excerpt from serialport.c:

....
void Init_serialport() {
  ...
  cSerialPort = rb_define_class("SerialPort", rb_cIO);
  rb_define_singleton_method(cSerialPort, "create", sp_create, 1);
  ...
  rb_eval_string(
    "class SerialPort\n"

      "private_class_method(:create)\n"
       ...
    "end\n"
  );
}

When serialport.so is 'require'd normally, the following error is reported:

"(eval):1: (eval):1:in `private_class_method': undefined method `create' for
class `Class' (NameError)
        from (eval):1
        from
c:/lang/ruby/ruby1.8.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:
in `require'
        from -e:1"

As you can see from the error, the 'require' that is being called is really
rubygems' 'custom_require', which is aliased to 'require' by rubygems.
Rubygems is being loaded automatically due to it's default inclusion in
RUBYOPT.

When I bypass the rubygems 'require' however, either by passing -rserialport
on the command line or by calling 'require__ "serialport"', the library
loads successfully.

I've looked at the require_custom code, and it's pretty straightforward.
Why is that eval failing under custom_require, but succeeding under Ruby's
vanilla 'require'?

Any help would be appreciated,

Avdi Grimm