Compiled Extensions

The purpose of require is to load Ruby extensions during program execution. But you may be surprised to learn that the extensions themselves may not all have been written in Ruby. Many are written in C, and require loads those extensions also.

C extensions are compiled to binary files of a type that, confusingly, are called shared object files (for reasons having nothing to do with Ruby or object-oriented programming). The names of these shared object files usually have the extension .so (for shared object) or .dll (for dynamic link library), depending on which platform you're using.

During the process of searching for the Ruby extension you have asked for with require, Ruby looks for binary files of these types, as well as ...

Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.