[#102393] [Ruby master Feature#17608] Compact and sum in one step — sawadatsuyoshi@...

Issue #17608 has been reported by sawa (Tsuyoshi Sawada).

13 messages 2021/02/04

[#102438] [Ruby master Bug#17619] if false foo=42; end creates a foo local variable set to nil — pkmuldoon@...

Issue #17619 has been reported by pkmuldoon (Phil Muldoon).

10 messages 2021/02/10

[#102631] [Ruby master Feature#17660] Expose information about which basic methods have been redefined — tenderlove@...

Issue #17660 has been reported by tenderlovemaking (Aaron Patterson).

9 messages 2021/02/27

[#102639] [Ruby master Misc#17662] The herdoc pattern used in tests does not syntax highlight correctly in many editors — eregontp@...

Issue #17662 has been reported by Eregon (Benoit Daloze).

13 messages 2021/02/27

[#102652] [Ruby master Bug#17664] Behavior of sockets changed in Ruby 3.0 to non-blocking — ciconia@...

Issue #17664 has been reported by ciconia (Sharon Rosner).

23 messages 2021/02/28

[ruby-core:102617] [Ruby master Bug#17657] Starting from ruby 2.3.0, LoadLibraryExA called in extension won't use PATH or current directory to find library and/or it's dependencies

From: egzumer@...
Date: 2021-02-26 11:13:57 UTC
List: ruby-core #102617
Issue #17657 has been updated by egzi (Krzysztof Egzmont).


Well, it turns out I did miss one thing
https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#-dll-loading

Sorry, please close this issue.

----------------------------------------
Bug #17657: Starting from ruby 2.3.0, LoadLibraryExA called in extension won't use PATH or current directory to find library and/or it's dependencies
https://bugs.ruby-lang.org/issues/17657#change-90604

* Author: egzi (Krzysztof Egzmont)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I'm on windows 10 pro. The sample code runs successfully on ruby up to 2.2.5. 
On newer versions I get "cannot load such file". The fallowing documentation lists PATH environment variable as one of the search paths, that are used to locate DLL modules, but it gets ignored.
https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#standard-search-order-for-desktop-applications
I suspect some permission issues but I read LoadLibraryExA and I can't see why this might be happening. I tried changing dwFlags, doesn't help. If I missed something obvious then I'm sorry.
I tried to boil down the problem to minimal sample code. It needs those two files and a *lib* directory with any DLL that would be loaded with *load_lib* global function.

I know that passing absolute path will make it work, but there is still problem when the library has some dependencies that are located in a different directory, those can't be find neither.

test.rb:
``` ruby
require 'devkit'
require 'mkmf'
create_makefile 'foobar'
`make`
require_relative 'foobar'

ENV['PATH'] = (Dir.pwd + '\lib;').gsub('/', '\\') + ENV['PATH']

load_lib('bz2.dll')
```

foobar.c:
``` c
#include "ruby.h"

VALUE rb_load_lib(VALUE self, VALUE path)
{
    HMODULE mod;
    printf("%s\n\n", getenv("PATH"));
    mod = LoadLibraryExA(RSTRING_PTR(path), NULL, 0);
    printf("LoadLibraryExA: %s\n", mod != 0 ? "SUCCESS" : "FAIL");
    return Qnil;
}

void Init_foobar()
{
    rb_define_global_function("load_lib", rb_load_lib, 1);
}

```





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next