Targeting Tamarin

Using the Tamarin Target

First you need to download and compile tamarin for your system. More information can be found in the Tamarin Build Documentation
You can also download a ready built binary (avmshell) from here:
Some changes are needed to the following classes:
  • Boot.hx
    Modify the standard std\flash\Boot.hx file by replacing it with the code from Boot.hx
  • System.hx
    Add a new System class by creating a folder avmplus in the std folder and in there add a new file System.hx.
    You should end up with: std\avmplus\System.hx

Now, let's do a simple test:
Create a file Main.hx and add the code below.

import avmplus.System;
@:ns("")@:native("IPL") class Main
    public function new()
        trace("hello cruel world from Haxe targeting avmshell! tamarin v" + System.getAvmplusVersion()); 
    public static function main() 
        var tt = new Main(); trace("goodbye cruel world! freeMem:" + System.freeMemory); 

Create a file build.hxml and add the following commands
-main Main 
-D avmshell
-swf main.swf 

Before we can test our compiled code in avmshell we need to create a little script that calls the main class in our swf:
Create a file with the following code:


and compile it to with:
java -jar asc.jar -import
(asc.jar and are part of the Flex sdk and can be downloaded from here )

Now we can finally run our test from terminal /command line:

avmshell main.swf

You should see printed:
Main.hx:5: hello cruel world from Haxe targeting avmshell! tamarin v2.1 1049616:
Main.hx:11: goodbye cruel world! freeMem:794624

Although you can extract the abc file from the compiled main.swf with this tool: (instructions), you can also use the main.swf without conversion as shown in the test above.
[ Please note this is work in progress based on an IRC conversation ]
The details of the IRC conversation

version #15438, modified 2012-09-05 03:42:03 by jan_flanders