The Windows version of CrossBridge 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 CrossBridge on Windows. CrossBridge 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:\crossbridge\
  2. Ensure 64-bit Java is installed
  3. Ensure Java is on your PATH
  4. Download the AIR SDK (some of the samples require it 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 CrossBridge is working by compiling the first sample:
    1. cd 01_HelloWorld
    2. make FLASCC=/cygdrive/c/crossbridge/sdk FLEX=/cygdrive/c/air_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 CrossBridge you can use a separate Cygwin installation as long as it is up to date and has at least these packages:

  • libuuid1
  • python
  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 ~/crossbridge/
  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 AIR SDK (some of the samples require it in order to be compiled.) This can be extracted to anywhere on your hard drive, but this readme will assume it is located at ~/air_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 CrossBridge is working by compiling the first sample:
    1. cd ~/crossbridge/sample/01_HelloWorld
    2. PATH=~/crossbridge/sdk/usr/bin:$PATH make FLASCC=~/crossbridge/sdk FLEX=~/air_sdk
    3. Launch the hello.swf file

Let's try a really simple example to see how CrossBridge 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> ~/crossbridge/sdk/usr/bin/gcc hello.c -o hello
Win> /cygdrive/c/crossbridge/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 CrossBridge 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> ~/crossbridge/sdk/usr/bin/gcc hello.c -emit-swf -o hello.swf
Win> /cygdrive/c/crossbridge/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=~/crossbridge/sdk/usr/bin:$PATH
Win> export PATH=/cygdrive/c/crossbridge/sdk/usr/bin:$PATH

This path contains replacements for the standard gcc/make toolchain which will do the CrossBridge 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 CrossBridge setup these resources and documentation should help you get started:

 

Samples CrossBridge 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 CrossBridge SDK.
C/C++ API A reference showing all of the C/C++ APIs that are part of CrossBridge.
ActionScript3 API A reference showing all of the ActionScript3 APIs that are part of CrossBridge. 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 CrossBridge 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.

 

CrossBridge generated SWFs are supported by Flash player 11.0 and AIR 3.0 and higher. SWCs generated by CrossBridge are supported by Flex Builder 4.6 and Flex SDK 4.6 or higher. Running CrossBridge 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.