Personal tools

Views

Alchemy:Documentation:Developing with Alchemy

From Adobe Labs

Technical Overview

The Alchemy SDK is a toolchain for compiling C/C++ and targeting the Flash virtual machine. It does not introduce new platform functionality to the Flash player, it simply retargets C/C++ code to run on the Flash VM and within it's security constraints. Alchemy exposes a somewhat POSIX compliant API. Not all POSIX functionality is implemented.

Alchemy is built on the LLVM compilation environment. LLVM uses a special version of gcc to compile to an intermediate bytecode optimized for a virtual machine. Read more about LLVM here [1]. These LLVM bytecode object files are then linked against libraries created to bridge various APIs into the Flash environment. The llvm code generator llc (with -march=avm2) then generates an ActionScript file by targeting a virtual machine built in ActionScript. The script generated is basically one huge finite state machine. It contains non-standard AS3 constructs including inline AS3 bytecode. The resulting script is then compiled using asm-asc, a custom AS compiler that supports the inline bytecode syntax as well as additional optimizations. The output from the compilation is either a standard SWC or a SWF with a "shabang" line at the top forcing it to run in the swfbridge tool.

Alchemy Tools

Alchemy C/C++ API

Alchemy ActionScript API

Retrieved from "http://labs.macromedia.com/wiki/index.php/Alchemy:Documentation:Developing_with_Alchemy"