.so file not found while importing ruby c extension. (on windows)

I have googled a lot and tried many answers but I was not able to find the solution for my issue.

I was trying to install the ruby-ibmdb gem and when I require it, I got an error that .so file is not found but that file was there in that location.

Why ruby is lying to me?

I have placed the .so file in ruby/bin and /lib and many places but it is working.

I have installed devkit and built the .so file my self(I thought Issue maybe because of diff build versions) and Installed the extension. No issues while installing the gem. But when I require it in the sample program it says .so file cannot be found. (But that file is present in the same location)

From the dependency walker, I came to know that my .so file is trying to load 64-bit dependent DLL’s.
Why it is loading 64bit DLL’s(Kernal32.dll and msvcrt.dll) has I have installed 32-bit ruby and devkit.


Im not sure, but the documentation here:

…says that the driver was only tested on 32 bit windows. so if youre running 64 bit windows, it might not work.

Can you give an example of the error message when you require it?


I have downloaded the 32 bit ruby and dev kit.


C:\Ruby_Programs>ruby connect.rb
Traceback (most recent call last):
        2: from connect.rb:2:in `<main>'
        1: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- ibm_db (LoadError)
        9: from connect.rb:2:in `<main>'
        8: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
        7: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
        6: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
        5: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/ibm_db-4.0.0-x86-mingw32/lib/ibm_db.rb:21:in `<top (required)>'
        4: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        3: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        2: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/ibm_db-4.0.0-x86-mingw32/lib/mswin32/ibm_db.rb:90:in `<top (required)>'
        1: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': 126: The specified module could not be found.   - C:/Ruby26/lib/ruby/gems/2.6.0/gems/ibm_db-4.0.0-x86-mingw32/lib/mswin32/rb2x/i386/ibm_db.so (LoadError)

I am the new owner of ibmdb/ruby-ibmdb. There was no perfect documentation for this issue and the old developer has left.

I was trying to install the driver on windows 64 bydownloading 32 bit ruby and devkit of 2.6 version.
I feel like I am something that might have added for c extensions in the latest release.


can any one help me on this issue?



The solution is set RUBY_DLL_PATH variable.(all dependencies path should be present in that).