[Ironruby-core] IronRuby not loading DLL

Tomas Matousek Tomas.Matousek at microsoft.com
Fri Mar 25 18:37:33 EDT 2011


You need to use const_get to access classes/namespaces whose names are not compatible with Ruby naming conventions. 
A module in Ruby must start with capital ASCII letter.

const_get(:mdMATCHUPOBJECTLib).const_get(:mdMUIncrementalClass).new should work.

Tomas

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Paul Wheeler
Sent: Thursday, March 24, 2011 2:01 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] IronRuby not loading DLL

I have been using IronRuby for a while now to do simple scripting against DotNet DLLs with great success. I ran in to a problem recently where I am asking IronRuby 1.1.1 to require a DLL but it does not appear to be loaded. I do not get an error message but cannot instantiate any types from the DLL. If I do "p Object.constants" it does not return any namespaces or classes from the DLL.

When trying to do:
"mdMATCHUPOBJECTLib::mdMUIncrementalClass.new"

I get the error:
"undefined method mdMATCHUPOBJECTLib"

Where mdMUIncrementalClass is a class in the DLL and mdMATCHUPOBJECTLib is the namespace. This works perfectly in C#/VisualStudio with the same DLL (I am basically using the exact same code in C# and Ruby). If it helps, this is an Interop DLL created by Visual Studio from a COM DLL.

--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core






More information about the Ironruby-core mailing list