Adobe Flash C++ Compiler (FlasCC)

A complete BSD-like C/C++ development environment with a GCC based cross-compiler capable of targeting the Adobe Flash Runtime.

The Windows version of FlasCC was compiled to run within the Cygwin environment. Cygwin is a Linux-like environment for Windows making it possible to port software running on POSIX systems (such as Linux, BSD, and Unix systems) to Windows. Cygwin is required to use FlasCC on Windows. FlasCC bundles a version of Cygwin that you can access by launching the run.bat file. Advanced users can use a separate Cygwin installation if desired.

  1. Extract the contents of the ZIP file onto your hard drive. This can be extracted to anywhere on your hard drive, but this readme will assume it is located at C:\flascc\
  2. Ensure 64-bit Java is installed
  3. Ensure Java is on your PATH
  4. Download the Flex SDK (some of the samples require Flex 4.6 or higher in order to be compiled.) This can be extracted to anywhere on your hard drive, but this readme will assume it is located at C:\flex_sdk\
  5. Download a debugger version of the Flash Player (only needed if you want to use GDB to debug your code)
  6. Double click the run.bat file
  7. Check that FlasCC is working by compiling the first sample:
    1. cd 01_HelloWorld
    2. make FLASCC=/cygdrive/c/flascc/sdk FLEX=/cygdrive/c/flex_sdk
    3. Launch the hello.swf file

Using a Separate Cygwin Installation

If you don't want to use the installation of Cygwin that is bundled with FlasCC you can use a separate Cygwin installation as long as it is up to date and has at least these packages:

  • make
  • libuuid1
  • python
  • cmake
  1. Extract the contents of the DMG file onto your hard drive. This can be extracted to anywhere on your hard drive, but this readme will assume it is located at ~/flascc/
  2. Ensure 64-bit Java is installed (Mac users should already have Java installed, but make sure to run Software Update to ensure you have the latest version)
  3. Download the Flex SDK (some of the samples require Flex 4.6 or higher in order to be compiled.) This can be extracted to anywhere on your hard drive, but this readme will assume it is located at ~/flex_sdk/
  4. Download a debugger version of the Flash Player (only needed if you want to use GDB to debug your code)
  5. Check that FlasCC is working by compiling the first sample:
    1. cd ~/flascc/sample/01_HelloWorld
    2. PATH=~/flascc/sdk/usr/bin:$PATH make FLASCC=~/flascc/sdk FLEX=~/flex_sdk
    3. Launch the hello.swf file

Let's try a really simple example to see how FlasCC works. Put the following code into a file called hello.c

#include <stdio.h>
int main()
{
    printf("Hello World!\n");
}

And compile it like this:

Mac> ~/flascc/sdk/usr/bin/gcc hello.c -o hello
Win> /cygdrive/c/flascc/sdk/usr/bin/gcc.exe hello.c -o hello.exe

The compiler may produce warnings about dropped arguments; these can safely be ignored. Running the resulting binary will print the string "Hello World!" to your console. By default the gcc and g++ compilers in the FlasCC toolchain will produce projector binaries. These are native executables that contain your application compiled to ActionScript bytecode and a captive copy of the ActionScript Virtual Machine (the virtual machine used in the Flash Runtime). Executing this projector binary will run your program.

To target the Flash player we will need to tell gcc/g++ to produce a SWF file instead of a projector binary. This can be done as follows:

Mac> ~/flascc/sdk/usr/bin/gcc hello.c -emit-swf -o hello.swf
Win> /cygdrive/c/flascc/sdk/usr/bin/gcc.exe hello.c -emit-swf -o hello.swf

If you load the resulting SWF into the standalone Flash player you should see "Hello World" on screen.

If you have a project with standard *nix-style makefiles and you want to use them as is, you can add the sdk/usr/bin folder to the head of your path like this:

Mac> export PATH=~/flascc/sdk/usr/bin:$PATH
Win> export PATH=/cygdrive/c/flascc/sdk/usr/bin:$PATH

This path contains replacements for the standard gcc/make toolchain which will do the FlasCC equivalent code transformations.

Note: Calling this command from a terminal will only update the PATH for the lifetime of that terminal window. To have this automatically set every time you launch a new terminal window consider adding the command to a .profile file.

Another way of setting the path is to pass it as a parameter to make. See the make file in the Example_BulletPhysicsLibrary example to see how this is done.

Now that you have FlasCC setup these resources and documentation should help you get started:

 

Release Notes Lists major features and known issues.
Samples FlasCC comes with a set of sample applications that demonstrate features of the SDK. You can find these examples in the samples folder. This page describes the features being demonstrated in more detail and includes links to the relevant sections of the reference guide for more information.
Reference Guide Describes each feature of the FlasCC SDK.
C/C++ API A reference showing all of the C/C++ APIs that are part of FlasCC.
ActionScript3 API A reference showing all of the ActionScript3 APIs that are part of FlasCC. The reference guide provides a high level explanation of these APIs with links into this API reference for more details.
Flash Runtime API

To interact with the Flash Runtime in your FlasCC compiled code you will need to use the ActionScript API exposed by the Flash Player. This reference lists all of the available APIs in the latest version of the Flash Player.

For more information on how to interop between C/C++ and the Flash API see this section of the reference guide.

Blog

The FlasCC Team Blog is maintained by the FlasCC engineering team at Adobe. This blog features tips and sample code using different features of the FlasCC SDK.

 

FlasCC generated SWFs are supported by Flash player 11.0 and AIR 3.0 and higher. SWCs generated by FlasCC are supported by Flex Builder 4.6 and Flex SDK 4.6 or higher. Running FlasCC generated SWFs in Flash player 10.x is not guaranteed to work and Adobe does not provide any support for that use-case.

Support for concurrency is only available in Flash 11.5 and higher when targeting SWF version 18. Use of other player APIs within inline-asm statements or via the Flash++ interop mechanism might also require a specific version of the Flash player. Performing runtime checks for available APIs will allow you to produce content that supports older Flash player versions with reduced functionality whilst being able to use the latest APIs when running in a recent version of the Flash player.

For a complete list of what APIs were exposed in each version of Flash visit the Flash Player feature list on the Adobe Developer Connection website.

FlasCC makes use of various open source components. In compliance with the licenses of these components, their source code is provided at the link ending this section. One of the components used by FlasCC and contained within the open source bundle is The LLVM Compiler Infrastructure. The LLVM Compiler Infrastructure provides various unit tests. One of these unit tests is based on ClamAV®, an antivirus engine. The ClamAV unit test contains sample input that can be malicious if explicitly invoked and may be flagged as such by antivirus software. This unit test and sample input is included in the open source bundle.

FlasCC Open Source Bundle