[pypy-dev] [pypy-svn] r49617 - pypy/branch/clr-module-improvements/pypy/module/clr

Antonio Cuni anto.cuni at gmail.com
Tue Dec 11 11:19:25 CET 2007


Hi Amit,

regmee at codespeak.net wrote:
> +    assembliesToScan = [ "/usr/lib/mono/1.0/mscorlib.dll",
> +                         "/usr/lib/mono/1.0/System.dll",
> +                         "/usr/lib/mono/1.0/System.Web.dll",
> +                         "/usr/lib/mono/1.0/System.Data.dll",
> +                         "/usr/lib/mono/1.0/System.Xml.dll",
> +                         "/usr/lib/mono/1.0/System.Drawing.dll"
> +                    ]
> +    assems = []
> +    for assemblyName in assembliesToScan:
> +        assems.append(System.Reflection.Assembly.LoadFile(assemblyName))

sorry for bugging you again :-),
but this is not what we want.

We don't need to preload assemblies that the user might not want. For 
example, in IronPython to access the System.Xml namespace you need to 
explicitly load System.Xml.dll by using one of the clr.LoadAssembly* 
methods.

Moreover, what happens if I wanto to load an assembly that it's not on 
this list? And what if I load an assembly after the list of namespaces 
has already been computed?

I think what you need to do is to maintain a cache of valid namespaces, 
and check whether a new assembly has been loaded every time you import 
something.
You can easily get the list of currently loaded assemblies by calling 
AppDomain.CurrentDomain.GetAssemblies().

ciao Anto



More information about the Pypy-dev mailing list