I'm trying to create modules (and classes, methods, constants, etc.)
from C by parsing an IDL file at runtime. I'm having trouble when I
try to access the module I just created (either from a client script
or from my code using rb_eval_string). My extension first loads an
..rb file. I can access the modules in that file from my code or from
a client script just fine. But when I define a module from code like:
new_mod = rb_define_module("Fruit");
and access it either from my code (i.e. rb_eval_string("Fruit")) or
from a client script that requires my extension, I get
uninitialized constant "Object::Fruit" (NameError)
even if I add the line
rb_define_const(rb_cObject, "Fruit", new_mod);
after the first line.
If I explicitly qualify it as "::Fruit",
it works, both from my code and from a client script, but I don't want
the client programmer to have to explicitly qualify every name from
the IDL file with global scope. How do I manage to put all the
modules, classes, constants, etc. that I define into the client's
namespace?