Hi,
I've just encountered the following problem:
I've installed the gem "builder" in version 2.0 via igem and it works
fine.
When using it in a script first the first 2 lines are:
require 'rubygems'
require 'builder'
In VB.net I execute ruby code in the following way:
I linked:
IronRuby.dll
IronRuby.Libraries.dll
IronRuby.Lbraries.Yaml.dll
from InstallationDirectory\Silverlight\bin\
my code which works fine with "regular" ruby code:
Sub Main(ByVal Args As String())
Dim rubyRuntime As Microsoft.Scripting.Hosting.ScriptRuntime
Dim rubyEngine As Microsoft.Scripting.Hosting.ScriptEngine
rubyRuntime = IronRuby.Ruby.CreateRuntime
rubyEngine = rubyRuntime.GetEngine("rb")
Dim strRuby As String
Dim fileReader As StreamReader
fileReader = New
StreamReader(System.Environment.CurrentDirectory &
"\" & Args(0))
strRuby = fileReader.ReadToEnd
fileReader.Close()
fileReader = Nothing
rubyEngine.Execute(strRuby)
End Sub
Now, when I compile the code the libraries I linked are copied in my
output
directory as usual. And here the problem starts. When this library
IronRuby.Libraries.dll is in the directory where my programm is running,
executing the "require 'rubygems'" throws an error. It's the same when I
start ir on the command line and type it in. When I delete this library
the
ruby code runs without any problem, but the VB.net program won't execute
any more. Here's the error message:
C:/Program Files/IronRuby 1.1/Lib/ironruby/thread.rb:16:in
`load_assembly': Specified type
IronRuby.StandardLibrary.Threading.ThreadingLibraryInitializer is not a
subclass of IronRuby.Builtins.LibraryInitializer (LoadError)
from C:/Program Files/IronRuby 1.1/Lib/ironruby/thread.rb:16
from C:/Program Files/IronRuby 1.1/Lib/ruby/1.9.1/rubygems.rb:16:in
`require'
from C:/Program Files/IronRuby 1.1/Lib/ruby/1.9.1/rubygems.rb:16
from (ir):1:in `require'
from (ir):1
The versions I use:
IronRuby 1.1.3.0 on .NET 4.0.30319.239
MS Visual Studio 2010
I desperately hope for help as I couldn't any helping post in the
archives!
thanks in advance
Andreas
on 2012-01-29 21:30
on 2012-01-30 00:23
Not sure if this is your problem, but off the top of my head I'll try help. IronRuby needs to know the path to it's standard library directory. This is stored in the ir.exe.config file that ships along with IronRuby. When you host IronRuby from inside another application, this config file isn't present. Rubygems isn't one of the core libraries (those are implemented in IronRuby.Libraries.dll), and so when you try and require rubygems, it goes looking for the standard library, and fails. Try open ir.exe.config from the IronRuby directory, and copy the parts which reference file paths over to your own app.exe.config (and remember to update the paths, etc). It should look kind of like this (NOTE: this is an old config file and so it won't be correct for the latest version of ir): http://code.google.com/p/efficientlylazycrypto/sou... Orion
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.