[IronPython] Referenced Assemblies with DLR languages

Doug Blank doug.blank at gmail.com
Thu Jan 13 13:09:50 CET 2011

On Tue, Jan 11, 2011 at 8:13 AM, Doug Blank <doug.blank at gmail.com> wrote:
> Two questions about referenced assemblies (which are really perhaps
> DLR questions):
> 1) I'd like to be able to use different names than are used in a DLL.
> For example, say I have a Library.dll, and it has a class
> "ReallyBadName". Is there an easy way that I can rename or alias
> ReallyBadName after I add a reference to Library? I'd like this to
> work for all of my DLR languages, so I'd like to do it right after I
> add the reference, rather than, say, doing it in Python with "import
> ReallyBadName as GoodName"---but that is the effect I want.

Ok, maybe if I ask this a slightly different way: when IronPython says
"import ReallyBadName" where does that name need to match in order to
import? I presume that I could change it somewhere in clr.References,
and could import the objects via another name. Would that work?

I'm trying to make generic DLLs that could be loaded directly from the
DLR languages, and would be appropriate for the IP users.

> 2) Is there a way that I could have a Library.dll bring in other
> assemblies so that they would be available to DLR languages? Of
> course, one could load an assembly in an assembly that you
> clr.AddReference, but that wouldn't make it available to all of the
> DLR languages right? It seems that one would need a callback where the
> clr was passed into the assembly which was clr.AddReference-ed, so
> that it could add references too. Could I overload the clr importer to
> do that? Or is there a better way?

Likewise, I'd like so that when I "import Library" (where Library is a
DLL), it will include other DLLs to be available for DLR language


> Thanks for any pointers,
> -Doug

More information about the Ironpython-users mailing list