ammer

Getting started

To use an existing native library, all that is required is to write a library definition:

class Foobar extends ammer.def.Library<"foobar"> {
  public static function repeat(word:String, count:Int):String;
}

The types used in the arguments must be among the supported FFI types. Libraries can define functions, variables, and datatypes. The functions can then be called like regular Haxe functions:

class Main {
  public static function main():Void {
    trace(Foobar.repeat("hello", 3));
  }
}

During compilation, the ammer haxelib must be used. Library-specific configuration can be added either using metadata or define flags. The define flags must include at least a build path (used for intermediate files) and an output path (where the ammer-generated dynamic libraries will be placed):

--library ammer
-D ammer.buildPath=build
-D ammer.outputPath=bin
--main Main
--hl bin/out.hl

A variety of configuration flags can be provided; see configuration for more details.

« Previous: Installation Next: Definition »