I'd like to build a special AIR launcher program in C along the lines of java.exe.
I've looked at running AIR programs with a process viewer and was able to locate the AIR runtime DLL that is being used. AIR programs are different than Java in that they are installed as platform-specific executables that bind the AIR runtime as an in-process shared library once they're launched (their icon is double-clicked by the user).
Well, I want to make an AIR launcher that is instead like the java.exe.
The java.exe is launched as a platform OS process that binds to the Java JVM runtime (JRE) as an in-process shared library. The java application that is to be executed is specified as a command-line argument to java.exe. Once java.exe is running and the JVM is fully functional, the specified java application class is loaded by the JVM class loader for execution. That specified Java application then takes over, in a sense "hijacking" the process of java.exe. Of course, the specified java application shows up in any process listing as the java.exe program that host it.
I want to make AIR app launching work like this. Why? So I can explore ways to hack AIR and perhaps overcome some of its many, many deficiencies. For instance, for starters I want to extend the AIR runtime experience with some new APIs that become available to the running AIR application.
My first order of business would be to:
- Implement a binding interface of ActionScript3 to C that is comparable to .NET PInvoke
- Add an API for process launching that is comparable to the APIs found in Java SE for doing this (Runtime.exec, ProcessBuilder, Process)
- Add support for an AIR application to be able to interact with stdin, stdout, stderr. Strangely, though Adobe added support for local file access in AIR, they have omitted interaction with these standard file pipes (yet they are found on any OS platform that AIR supports).
- Implement support of AMF over stdin, stdout, stderr - so AIR (or Java or any AMF capable language) apps can interprocess communication via exchanging AMF objects. This would add a touch of Microsoft's PowerShell to AIR.
Currently Merapi provides a AMF bridge with Java, so that demonstrates the efficacy of this. Alas, Merapi has to use a localhost port and socket for doing the interprocess communication - which is a clumsy way to go relative to using stdin/stdout/stderr interprocess pipes instead.