Iron Python / Iron Ruby EXE
Asked Answered
M

3

7

I've always had this dream of creating a 'real exe' from a scripting language. With the available of DLR-based implementations of Python and Ruby, is this getting any closer to reality?

I'd like to create a 'real application':

  • A Windows Forms App
  • A Console App
  • A Windows Service

And have the unit of distribution be a compiled exe.

Is this possible? Or has MS just created script file interpreters based on .NET?

If you are doing this, how are you structuring your applications / projects? Are you using a hybrid of C# and DLR code?

Mortonmortuary answered 18/6, 2009 at 17:22 Comment(0)
R
4

An IronPython or IronRuby project can be compiled to a dll or executable just fine and will be 'real' executables in every way with the proviso that the person running them must have the relevant .Net framework and dependencies installed (dependencies may be present in the same directory by default instead but the framework must be installed). The integration with Visual Studio is still not there but projects like IronPythonStudio use the free VS Shell to good effect. The existence of the DLR as a dependency for c# dynamic in VS 2010 should mean that integration with VS from the Iron* groups becomes an easier goal and a higher priority.

The result is in no way interpreted (the CIL is jitted into machine code at runtime or via ngen if desired) and certain aspects of the DLR mean some actions are deferred in a similar fashion to latebinding but more powerfully and crucially with some sophisticated caching mechanisms to allow this to be relatively fast compared with naive interpreters.

Many traditionally interpreted scripting languages are creating their own VM based compilation strategies or leverage existing ones (like the JVM, the .Net CLR or open ones like the LLVM) since this leads to significant performance increases in many common cases.

In the case of the Iron* languages the benefit of the MS CLR as a basis is that the resulting executables 'Just Work' on the vast majority of installations of the most common OS family. Contrast to Java where a jar file is not 'runnable' by directly clicking / or 'executing' via the shell in many operating systems. The flipside from this is that this reduces interoperability compared to say a JVM or LLVM based solution where the platform support is broader but, inevitably, more diverse in OS integration.

Reprimand answered 18/6, 2009 at 18:51 Comment(4)
Can you provide documentation or a procedure for this? It doesn't seem that you can "File->New Project" Python in Visual Studio, so some extra work is required.Mortonmortuary
The VS integration is still not there (I will add a note to that effect) but you can use codeplex.com/IronPythonStudio to get a VS like environment (it uses the cut down VS Shell as its base)Reprimand
What is the actual method of getting compiled DLR code into your executables? I've only been able to find the link in the answer below, and it only seems to refer to beta code.Mortonmortuary
the IronPython.Hosting.Compiler is what you want to use. The shell integration project I linked to uses that to provide IronPythonTasks to compile to dll/exe/winexe and is likely usable from vanilla VS with some tweaks. The python code is always going to need to be in its own dll (you could merge the dlls after via ilmerge.exe if you want) and the compilation will be messy till the VS integration is there.Reprimand
S
1

You can create exe's from regular python using Py2Exe. But there shouldn't be anything preventing you from creating exes with IronPython using Visual Studio or SharpDevelop

Semidiurnal answered 18/6, 2009 at 17:47 Comment(0)
F
-1

although not directly related to iron* question, might be interesting for someone wanting binaries from python scripts: pyinstaller

works under Windows (32-bit and 64-bit), Linux (32-bit and 64-bit) and Mac OS X (32-bit only)

works under any version of Python from 1.5 up to 2.7

Furbish answered 25/11, 2010 at 21:1 Comment(2)
got nothing to do with the questionRanch
if you read the first sentence of the question post, you will see what my post has to do with the question...Furbish

© 2022 - 2024 — McMap. All rights reserved.