* [ruby-core:94482] [Ruby master Bug#16117] ruby2.6.3(x86) use fiddle faild to load dll in windows7
[not found] <redmine.issue-16117.20190822122120@ruby-lang.org>
@ 2019-08-22 12:21 ` duke-1722
2019-08-22 12:22 ` [ruby-core:94483] " duke-1722
2019-08-23 7:54 ` [ruby-core:94499] " duke-1722
2 siblings, 0 replies; 3+ messages in thread
From: duke-1722 @ 2019-08-22 12:21 UTC (permalink / raw)
To: ruby-core
Issue #16117 has been reported by whdukewu (Kewu DU).
----------------------------------------
Bug #16117: ruby2.6.3(x86) use fiddle faild to load dll in windows7
https://bugs.ruby-lang.org/issues/16117
* Author: whdukewu (Kewu DU)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I have a dll build by MinGW32 in windows7, in ruby2.2, I could use fiddle dlload this dll success, but in the same system, use 2.6.3 failed to dlload this dll, always report No such file or direcoty.
**///////// Ruby2.2 success load the dll and call function in dll /////////**
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>C:\TestTools\impeller\lib\Ruby\bin\ruby -v
ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>C:\TestTools\impeller\lib\Ruby\bin\ruby testmml_win.rb F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\
Demo for invoke C# code from ruby...
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\libhostprotocol.dll
Load CoreCLR from F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\ success
CoreCLR Started success.
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>
**///////// Ruby2.6.3 success load the dll and call function in dll /////////**
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32]
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>ruby testmml_win.rb F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x
86\publish\
Demo for invoke C# code from ruby...
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\libhostprotocol.dll
Traceback (most recent call last):
7: from testmml_win.rb:24:in `<main>'
6: from testmml_win.rb:26:in `<module:ProtocolTest>'
5: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `dlload'
4: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `collect'
3: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:87:in `block in dlload'
2: from C:/Ruby26/lib/ruby/2.6.0/fiddle.rb:47:in `dlopen'
1: from C:/Ruby26/lib/ruby/2.6.0/fiddle.rb:47:in `new'
C:/Ruby26/lib/ruby/2.6.0/fiddle.rb:47:in `initialize': No such file or directory (Fiddle::DLError)
5: from testmml_win.rb:24:in `<main>'
4: from testmml_win.rb:26:in `<module:ProtocolTest>'
3: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `dlload'
2: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `collect'
1: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:86:in `block in dlload'
C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:89:in `rescue in block in dlload': can't load F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\libhostprotocol.dll (Fiddle::DLError)
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>
**the same testmml_win.rb in the same system, ruby2.2 works, ruby2.6.3 failed!**
**below is the test ruby code:**
`require 'fiddle'
require 'fiddle/import'
if ARGV.length < 1
puts "Missing libPath argument..."
puts "Usage: ruby HostTest2.rb libPath"
puts "Sample: ruby HostTest2.rb /home/ProtocolAdapter/output"
exit
end
puts "Demo for invoke C# code from ruby..."
String libPath = ARGV[0]
if libPath[libPath.length - 1] != '\\'
libPath = libPath + '\\'
end
puts libPath
$libCoreCLR_so_path = libPath + "libhostprotocol.dll"
puts $libCoreCLR_so_path
module ProtocolTest
extend Fiddle::Importer
dlload $libCoreCLR_so_path
extern 'void Init(const char* libPath)'
end
ProtocolTest.Init(libPath);`
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:94483] [Ruby master Bug#16117] ruby2.6.3(x86) use fiddle faild to load dll in windows7
[not found] <redmine.issue-16117.20190822122120@ruby-lang.org>
2019-08-22 12:21 ` [ruby-core:94482] [Ruby master Bug#16117] ruby2.6.3(x86) use fiddle faild to load dll in windows7 duke-1722
@ 2019-08-22 12:22 ` duke-1722
2019-08-23 7:54 ` [ruby-core:94499] " duke-1722
2 siblings, 0 replies; 3+ messages in thread
From: duke-1722 @ 2019-08-22 12:22 UTC (permalink / raw)
To: ruby-core
Issue #16117 has been updated by whdukewu (Kewu DU).
**testmml_win.rb code:**
require 'fiddle'
require 'fiddle/import'
if ARGV.length < 1
puts "Missing libPath argument..."
puts "Usage: ruby HostTest2.rb libPath"
puts "Sample: ruby HostTest2.rb /home/ProtocolAdapter/output"
exit
end
puts "Demo for invoke C# code from ruby..."
String libPath = ARGV[0]
if libPath[libPath.length - 1] != '\\'
libPath = libPath + '\\'
end
puts libPath
$libCoreCLR_so_path = libPath + "libhostprotocol.dll"
puts $libCoreCLR_so_path
module ProtocolTest
extend Fiddle::Importer
dlload $libCoreCLR_so_path
extern 'void Init(const char* libPath)'
end
ProtocolTest.Init(libPath);
----------------------------------------
Bug #16117: ruby2.6.3(x86) use fiddle faild to load dll in windows7
https://bugs.ruby-lang.org/issues/16117#change-80915
* Author: whdukewu (Kewu DU)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I have a dll build by MinGW32 in windows7, in ruby2.2, I could use fiddle dlload this dll success, but in the same system, use 2.6.3 failed to dlload this dll, always report No such file or direcoty.
**///////// Ruby2.2 success load the dll and call function in dll /////////**
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>C:\TestTools\impeller\lib\Ruby\bin\ruby -v
ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>C:\TestTools\impeller\lib\Ruby\bin\ruby testmml_win.rb F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\
Demo for invoke C# code from ruby...
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\libhostprotocol.dll
Load CoreCLR from F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\ success
CoreCLR Started success.
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>
**///////// Ruby2.6.3 success load the dll and call function in dll /////////**
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32]
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>ruby testmml_win.rb F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x
86\publish\
Demo for invoke C# code from ruby...
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\libhostprotocol.dll
Traceback (most recent call last):
7: from testmml_win.rb:24:in `<main>'
6: from testmml_win.rb:26:in `<module:ProtocolTest>'
5: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `dlload'
4: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `collect'
3: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:87:in `block in dlload'
2: from C:/Ruby26/lib/ruby/2.6.0/fiddle.rb:47:in `dlopen'
1: from C:/Ruby26/lib/ruby/2.6.0/fiddle.rb:47:in `new'
C:/Ruby26/lib/ruby/2.6.0/fiddle.rb:47:in `initialize': No such file or directory (Fiddle::DLError)
5: from testmml_win.rb:24:in `<main>'
4: from testmml_win.rb:26:in `<module:ProtocolTest>'
3: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `dlload'
2: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `collect'
1: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:86:in `block in dlload'
C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:89:in `rescue in block in dlload': can't load F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\libhostprotocol.dll (Fiddle::DLError)
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>
**the same testmml_win.rb in the same system, ruby2.2 works, ruby2.6.3 failed!**
**below is the test ruby code:**
`require 'fiddle'
require 'fiddle/import'
if ARGV.length < 1
puts "Missing libPath argument..."
puts "Usage: ruby HostTest2.rb libPath"
puts "Sample: ruby HostTest2.rb /home/ProtocolAdapter/output"
exit
end
puts "Demo for invoke C# code from ruby..."
String libPath = ARGV[0]
if libPath[libPath.length - 1] != '\\'
libPath = libPath + '\\'
end
puts libPath
$libCoreCLR_so_path = libPath + "libhostprotocol.dll"
puts $libCoreCLR_so_path
module ProtocolTest
extend Fiddle::Importer
dlload $libCoreCLR_so_path
extern 'void Init(const char* libPath)'
end
ProtocolTest.Init(libPath);`
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:94499] [Ruby master Bug#16117] ruby2.6.3(x86) use fiddle faild to load dll in windows7
[not found] <redmine.issue-16117.20190822122120@ruby-lang.org>
2019-08-22 12:21 ` [ruby-core:94482] [Ruby master Bug#16117] ruby2.6.3(x86) use fiddle faild to load dll in windows7 duke-1722
2019-08-22 12:22 ` [ruby-core:94483] " duke-1722
@ 2019-08-23 7:54 ` duke-1722
2 siblings, 0 replies; 3+ messages in thread
From: duke-1722 @ 2019-08-23 7:54 UTC (permalink / raw)
To: ruby-core
Issue #16117 has been updated by whdukewu (Kewu DU).
Problem solved:
the dll i used compiled by MinGW, the dll need libstdc++-6.dll, after I add **-static-libgcc -static-libstdc++** compile flag to the dll, problem solved!
----------------------------------------
Bug #16117: ruby2.6.3(x86) use fiddle faild to load dll in windows7
https://bugs.ruby-lang.org/issues/16117#change-80934
* Author: whdukewu (Kewu DU)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I have a dll build by MinGW32 in windows7, in ruby2.2, I could use fiddle dlload this dll success, but in the same system, use 2.6.3 failed to dlload this dll, always report No such file or direcoty.
**///////// Ruby2.2 success load the dll and call function in dll /////////**
```text
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>C:\TestTools\impeller\lib\Ruby\bin\ruby -v
ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>C:\TestTools\impeller\lib\Ruby\bin\ruby testmml_win.rb F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\
Demo for invoke C# code from ruby...
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\libhostprotocol.dll
Load CoreCLR from F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\ success
CoreCLR Started success.
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>
```
**///////// Ruby2.6.3 success load the dll and call function in dll /////////**
```text
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32]
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>ruby testmml_win.rb F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x
86\publish\
Demo for invoke C# code from ruby...
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\libhostprotocol.dll
Traceback (most recent call last):
7: from testmml_win.rb:24:in `<main>'
6: from testmml_win.rb:26:in `<module:ProtocolTest>'
5: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `dlload'
4: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `collect'
3: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:87:in `block in dlload'
2: from C:/Ruby26/lib/ruby/2.6.0/fiddle.rb:47:in `dlopen'
1: from C:/Ruby26/lib/ruby/2.6.0/fiddle.rb:47:in `new'
C:/Ruby26/lib/ruby/2.6.0/fiddle.rb:47:in `initialize': No such file or directory (Fiddle::DLError)
5: from testmml_win.rb:24:in `<main>'
4: from testmml_win.rb:26:in `<module:ProtocolTest>'
3: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `dlload'
2: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:77:in `collect'
1: from C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:86:in `block in dlload'
C:/Ruby26/lib/ruby/2.6.0/fiddle/import.rb:89:in `rescue in block in dlload': can't load F:\TOOLCODE\coreclr_win\Navigator2-linux\src\CSharpAdapter\CSharpAdapter\bin\Release\netcoreapp3.0\win-x86\publish\libhostprotocol.dll (Fiddle::DLError)
F:\TOOLCODE\coreclr_win\Navigator2-linux\src\ProtocolHost\HostTest\ruby\Mml>
```
**the same testmml_win.rb in the same system, ruby2.2 works, ruby2.6.3 failed!**
**below is the test ruby code:**
```ruby
require 'fiddle'
require 'fiddle/import'
if ARGV.length < 1
puts "Missing libPath argument..."
puts "Usage: ruby HostTest2.rb libPath"
puts "Sample: ruby HostTest2.rb /home/ProtocolAdapter/output"
exit
end
puts "Demo for invoke C# code from ruby..."
String libPath = ARGV[0]
if libPath[libPath.length - 1] != '\\'
libPath = libPath + '\\'
end
puts libPath
$libCoreCLR_so_path = libPath + "libhostprotocol.dll"
puts $libCoreCLR_so_path
module ProtocolTest
extend Fiddle::Importer
dlload $libCoreCLR_so_path
extern 'void Init(const char* libPath)'
end
ProtocolTest.Init(libPath);
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread