[IronPython] Transparent import of dlls?

Markus Schaber m.schaber at 3s-software.com
Tue Mar 29 07:50:43 PDT 2011


Hi, Jeff,

Von: Jeff Hardy [mailto:jdhardy at gmail.com]:

> > We're currently using IronPython 2.6 in a hosted .NET 2 environment.
> 
> For ipy.exe, there's a special directory called 'DLLs' that it reads
on
> startup and does the hosting equivalent of clr.AddReference for each
.dll
> in the folder. That's about the best you can do right now.

That DLLs directory seems to be a way which we can follow in our own
product.

The disadvantage is that all DLLs are read, whether they're imported, or
not.

> I've been thinking of adding support for .ipyd files (similar to
Python
> .pyd files), which could handle this case, but haven't thought it
through
> yet.

My suggestion is: "import foo" searches for a foo.ipyd (which basically
is a renamed foo.dll) in the search path, and can use both pyc-compiled
and handcrafted dlls.

Our use-case is to re-implement the API of 3rd-party native cPython
modules (like pysvn in my case) in C#. This should work as a drop-in
solution - drop the .dll in some appropriate place, and "import pysvn"
works without any changes in the actual application.

Regards,
Markus




More information about the Users mailing list