[Ironruby-core] IronRuby not loading DLL

Tomas Matousek Tomas.Matousek at microsoft.com
Sat Mar 26 23:01:21 EDT 2011


What would such block usually do? Uppercase the first letter of a lower-cased class/namespace? We could do that or some other mangling automatically. Is there any value in customizing the mangling?

Being it automatic would help you to discover the constants since they would appear in Module#constants.

Tomas

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Charles Strahan
Sent: Saturday, March 26, 2011 10:00 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] IronRuby not loading DLL

Tomas, how would you feel about adding an optional block param to require/load_assembly for overriding how .NET types are mapped to constants?  That might be prove beneficial in cases such as these.

-Charles

On Fri, Mar 25, 2011 at 5:37 PM, Tomas Matousek <Tomas.Matousek at microsoft.com<mailto:Tomas.Matousek at microsoft.com>> wrote:
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> [mailto: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<mailto: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<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core




_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20110327/f964cae3/attachment-0001.html>


More information about the Ironruby-core mailing list