[IronPython] Transparent import of dlls?

Markus Schaber m.schaber at 3s-software.com
Tue Mar 29 03:30:49 PDT 2011


Hi,

 

I have some questions that may seem stupid, but I did not find the right
answers yet. So simple pointers to the correct google query are as
welcome as elaborate Howtos. J

 

For cPython, it is possible to compile a module into a .pyc file. If
this file resides in sys.path, it is transparently used instead of the
.py source file. (We can ignore the exact details of lookup and version
dependency here.)

 

For IronPython, there is the pyc.py compiler script. This allows a
python module to be precompiled into a .NET dll. However, it seems that
it is not used transparently when placed in a directory in sys.path, one
has to explicitly add a Reference to the dll (via clr.AddReference or
hosting API).

 

Now my questions:

 

Is there any way to make this work transparently? (e. G. via a Flag to
the interpreter, or a modified import() function, or renaming the .dll
to .pyc?)

 

Is there a way to extend this mechanism to python modules created in C#?
(Creating a "foo.dll" that contains a "foo" module created via
PythonModuleAttribute, similar to the way the modules in
Ironpython.Modules.dll are created).

 

We're currently using IronPytho 2.6 in a hosted .NET 2 environment.

 

Thanks a lot,

 

Regards,

Markus

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20110329/9b5e7348/attachment.htm>


More information about the Users mailing list