# Problems with "require" when embedding Ruby

**URL:** <https://www.ruby-forum.com/t/problems-with-require-when-embedding-ruby/77298>\
**Category:** Ruby\
**Created:** [March 6, 2006, 4:59pm UTC](https://www.ruby-forum.com/t/problems-with-require-when-embedding-ruby/77298 "2006-03-06T16:59:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rurouni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/49beb7/32.png) [@Rurouni](https://www.ruby-forum.com/u/Rurouni)\
**Post date:** [March 6, 2006, 4:59pm UTC](https://www.ruby-forum.com/t/problems-with-require-when-embedding-ruby/77298/1 "2006-03-06T16:59:08Z")

</div>

I have Ruby interpreter embedded in engine… so far all was good. But  
when I tried to require custom extension compiled in .dll(some C++  
exported using SWIG) I encountered an error… As far as I know require  
simple is searching for .dll or .so with same name… Maybe SWIG  
generates bad dll , but standart non embedded Ruby runs this require  
very well…  
Do you have any advices? Any help will be thanksfull.

---

<div class="post-metadata">

**Author:** ![Rurouni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/49beb7/32.png) [@Rurouni](https://www.ruby-forum.com/u/Rurouni)\
**Post date:** [March 6, 2006, 5:05pm UTC](https://www.ruby-forum.com/t/problems-with-require-when-embedding-ruby/77298/2 "2006-03-06T17:05:40Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Problems with “require” when embedding Ruby” on Tue, 7 Mar 2006  
00:59:24 +0900,  
Rurouni [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have Ruby interpreter embedded in engine… so far all was good. But  
> when I tried to require custom extension compiled in .dll(some C++  
> exported using SWIG) I encountered an error…

Are you using rb\_require()? If so, try the following:

rb\_funcall(Qnil, rb\_intern(“require”), 1, rb\_str\_new2(“YOUR\_LIB”));

Thanks,
