From: Eric Hodel Date: 2008-01-31T08:14:11+09:00 Subject: Re: Using gems from C extensions On Jan 30, 2008, at 03:40 AM, Andre Nathan wrote: > I'm trying to use the json gem from a C extension. Doing this fails > with > "no such file to load -- json (LoadError)": > > rb_require("rubygems"); > rb_require("json"); > > However, if I add > > rb_funcall(rb_mKernel, rb_intern("gem"), 1, rb_str_new2("json")); > > before rb_require("json"), then it works fine. Is that how it's > supposed > to work? Yes. rb_require calls the base require, not the RubyGems overridden one. Instead of calling #gem, you can rb_funcall require instead.