Skip to content

For gem developers

Lars Kanis edited this page Mar 30, 2017 · 33 revisions

RubyInstaller2 for Windows porting guide for gem developers

DLL loading

Dependent DLLs can be loaded by using the function RubyInstaller::Runtime.add_dll_directory , like in the pg gem . It is not sufficient to add the DLL directory to the PATH environment variable. RubyInstaller2 ignores the PATH variable for all DLL searches.

MSYS2 library dependency

It is possible to specify dependencies to MSYS2-packages or MSYS2-MINGW packages in the gemspec of a gem to be installed. Set gemspec.metadata['msys2_dependencies'] or gemspec.metadata['msys2_mingw_dependencies'] to a space separated list of pacman packages. Optionally the name can be followed by a version restriction. However keep in mind that MSYS2 usually provides only one version at the same time for each package.

Examples:

gemspec.metadata['msys2_mingw_dependencies'] = 'libusb sqlite'

or

gemspec.metadata['msys2_mingw_dependencies'] = 'libusb>=1.0.21'

MSYS2 package dependencies are installed per pacman command, when a gem is about to be installed. The extconf.rb within a gem can access the newly installed MSYS2-MINGW libraries. If the package installation fails, the output of pacman is printed to the console, but the gem installation continues nevertheless. Insofar setting a MSYS2 dependency can make the installation easier, but will not brake the gem installation in case of changed MSYS2 packages. Installation of MSYS2(-MINGW) packages can be disabled per gem install gemname.gem --ignore-dependencies .

Clone this wiki locally