Cannot require .so file on Windows if the file path is unicode (Includes patch)
It doesn't seem possible to load a C extension that is inside a non-ascii path.
- Extract the attached zip file (with a decent unzip program such as 7-zip, that preserves unicode paths)
- cd to where you extracted
- launch irb
- require './foo.rb' (All this does is require a simple so file inside the folder 'てすと')
- You'll see a failure
The culprit is in function dln_load, it uses the ANSI version of LoadLibrary and passes in the char* path given to the function. My patch converts it to wide char and uses LoadLibraryW. I have assumed that the given path is UTF-8 encoded, which seems to work but I am not sure if this is a safe assumption.
I hope the patch is in the right format, I wasn't sure. Thanks for your time!
Updated by nobu (Nobuyoshi Nakada) almost 6 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r45523.
dln.c: non-ascii path on Windows
- dln.c (dln_load): use wchar version to load a library in non-ascii path on Windows. based on the patch by Bugra Barin in [ruby-core:61845]. [Bug #9699]