Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please embed dependency manifest into the Ruby DLL #144

Open
k-takata opened this issue Mar 14, 2019 · 2 comments
Open

Please embed dependency manifest into the Ruby DLL #144

k-takata opened this issue Mar 14, 2019 · 2 comments

Comments

@k-takata
Copy link

What problems are you experiencing?

Currently, when an application other than ruby(w).exe tries to load Ruby DLL ((x64-)msvcrt-ruby2X0.dll), the ruby_builtin_dlls directory must be added in the PATH environment. Otherwise, the application fails to load the Ruby DLL.

If the following manifest is embedded into the Ruby DLL, no need to add the ruby_builtin_dlls directory into the PATH environment.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity version="1.0.0.0" type="win32" name="ruby_builtin_dlls" />
</dependentAssembly>
</dependency>
</assembly>

So, please embed this manifest into the Ruby DLL (for convenience).
(Currently, the dependency manifest is only embedded in ruby.exe and rubyw.exe.)

Steps to reproduce

  1. Download Vim (gvim_8.1.1006_x86.zip) from here.
  2. Unpack gvim_8.1.1006_x86.zip and execute vim/vim81/gvim.exe.
  3. Type :ruby p RUBY_VERSION Enter
  4. gvim.exe fails to load msvcrt-ruby240.dll.

If C:\Ruby24\bin\ruby_builtin_dlls is added in the PATH environment, the Ruby DLL will be loaded and the version (e.g. "2.4.4") will be shown.

If the above manifest is embedded into msvcrt-ruby240.dll, the Ruby version will be shown even without adding the ruby_builtin_dlls directory to the PATH.
To embed the manifest, you can use the mt command from VC++:

mt -manifest msvcrt-ruby240.dll.manifest -outputresource:msvcrt-ruby240.dll;2

This is also the same for 64-bit versions and also for Ruby 2.5 and 2.6.

What's the output from ridk version?

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Mar 15, 2019

@k-takata

I quickly looked at this, as I work with an application that uses 'embedded ruby', and I've pushed newer versions of Ruby into it for quite a while.

Have you tried requiring an so file that has dll dependencies, like OpenSSL? It didn't work for me...

EDIT: the app I was working with does not add msys64/mingw64/bin via rubygems/defaults/operating_system.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants