# Loading extensions and embedding

**URL:** <https://www.ruby-forum.com/t/loading-extensions-and-embedding/139992>\
**Category:** Ruby\
**Created:** [June 9, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/loading-extensions-and-embedding/139992 "2008-06-09T22:06:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Remi\_Gillig](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/439d5e/32.png) [@Remi\_Gillig](https://www.ruby-forum.com/u/Remi_Gillig)\
**Post date:** [June 9, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/loading-extensions-and-embedding/139992/1 "2008-06-09T22:06:21Z")

</div>

Hello,

I’m trying to load the statically linked extensions. Ruby  
(1.8.7) was compiled using the “–with-static-linked-ext” flag.

I made a little program that loads and runs a Ruby script.  
Unfortunately, the extensions don’t seem to work inside  
my own code. However, they work with the normal Ruby  
interpreter.

Here is the error I have with my program :  
./test.rb:2: no such file to load – socket  
./lib/ping.rb:12  
./test.rb:2:in `require’  
./test.rb:2  
My script is :  
require ‘ping’  
print(“Ping [google.com](http://google.com) : #{Ping.pingecho(“[google.com](http://google.com)”, 10, 80)}\n”)

The initialisation of the Ruby environment is done like this :  
ruby\_init();  
ruby\_incpush(“.”);  
ruby\_incpush(“lib”);

Maybe there is a function to load the static extensions  
but reading the code of the Ruby interpreter is not really  
clear. Any idea? Thanks.

Remi Gillig.
