Interface
The main points of interaction with ammer-core are:
ammer.core.Platform(and concrete implementations inammer.core.plat.*),ammer.core.Library,ammer.core.Marshal, andammer.core.Builder(and concrete implementations inammer.core.build.*).
Platform
A Platform represents one of ammer/ammer-core targets. It can be constructed by calling ammer.core.Platform.createCurrentPlatform, or by directly calling a constructor of one of the ammer.core.plat.* types. The constructor takes a platform configuration, which is a class that contains at least the fields defined in ammer.core.plat.BaseConfig, but may contain more (required) fields: see ammer.core.plat.(Platform).(Platform)Config.
Platforms are used to create libraries with the createLibrary method. Once a library is finished (all its types and functions are declared), it is given to the platform with addLibrary. Finally, the finalise method returns a build program to be used by the builder.
Library
A Library represents a set of types and functions that will be compiled as one unit into a dynamic library (.dll, .dylib, .so).
As mentioned above, a Library is obtained from a platform using createLibrary: this function takes a library configuration object. This is a class that contains at least the fields defined in ammer.core.LibraryConfig, but platforms may add more fields, see ammer.core.plat.(Platform).(Platform)LibraryConfig.
Libraries contain a reference to a marshal object, and can have code added to them using these functions:
addInclude,addCode,addHeaderCode— add code directly.addFunction— adds a function with the given signature and body which can be called from Haxe using the returned expression.addCallback,addStaticCallback— add functions forwarding calls to Haxe closures (or static methods, respectively) that can be called from native code using the returned name. The code provided to these functions will often make use of theclosureCallandstaticCallfunctions, which performs the actual call to a Haxe closure, given its reference.
Marshal
Marshal is the class that defines how values are marshalled (passed through) between Haxe and C. It has methods for each kind of type that ammer-core understands. These methods return instances of TypeMarshal, which can then be passed to functions such as addFunction to define signatures of functions.
Builder
A Builder represents a build system, such as GCC or MSVC, that is used to execute the build steps returned by finalising a platform, with the build function.