I must be missing something obvious. I have come across several references to Python.Net more or less working with Mono on Linux, although not reliably. The thing is, I don't understand how it can work. The interop assemblies (eg CLR.dll) are .NET assemblies, which means they are also PE format, not ELF. On Windows, the DLL is loaded and the CLR initialized automagically by the Windows/.NET loaders. But how does this work on Linux?
I must be missing something obvious. I have come across several references to Python.Net more or less working with Mono on Linux, although not reliably. The thing is, I don't understand how it can work. The interop assemblies (eg CLR.dll) are .NET assemblies, which means they are also PE format, not ELF.
On Windows, the DLL is loaded and the CLR initialized automagically by the Windows/.NET loaders. But how does this work on Linux?
The hack of getting CLR.dll to bootstrap Python for .NET into an existing running CPython does *not* work on Linux. It works on windows because there is a way to do 'unmanaged exports' from a managed dll that windows understands. I (ab)use this to trick CPython into thinking its just loading a normal C extension module. On linux, you have to run the managed version of python.exe that comes with the package. Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com
Brian, Thanks. For some reason I made the assumption that the python.exe was a C binary. I should have looked more closely at the distribution. Did you consider going with a hosting/embedding approach instead of generating C exports via IL? We use the CLR Hosting API on Windows and it works well, although of course it forces you to do a bit of COM programming. I have not used the Mono Embedding API but from reading the docs it looks like it would be easy to use. One nice thing about this approach is that you can run all of your managed code in a separate (ie non-default) AppDomain, which can be useful. Mark Traudt Quantifi Inc. 20 Commerce Drive Cranford, NJ 07016 mtraudt@quantifisolutions.com http://www.quantifisolutions.com Phone: (908) 272-7740 Fax: (646) 304-3440 _______________________________________________________________________ This message is intended solely for the designated recipient(s) named above and may be legally privileged and/or confidential. If you are not the named addressee you should not disseminate, distribute or copy this message.
-----Original Message----- From: Brian Lloyd [mailto:brian@zope.com] Sent: Thursday, May 12, 2005 10:48 AM To: mtraudt@quantifisolutions.com; pythondotnet@python.org Subject: RE: [Python.NET] Mono Support
I must be missing something obvious. I have come across several references to Python.Net more or less working with Mono on Linux, although not reliably. The thing is, I don't understand how it can work. The interop assemblies (eg CLR.dll) are .NET assemblies, which means they are also PE format, not ELF.
On Windows, the DLL is loaded and the CLR initialized automagically by the Windows/.NET loaders. But how does this work on Linux?
The hack of getting CLR.dll to bootstrap Python for .NET into an existing running CPython does *not* work on Linux. It works on windows because there is a way to do 'unmanaged exports' from a managed dll that windows understands. I (ab)use this to trick CPython into thinking its just loading a normal C extension module.
On linux, you have to run the managed version of python.exe that comes with the package.
Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com
participants (3)
-
Brian Lloyd
-
mtraudt
-
mtraudt@quantifisolutions.com