Skip to content

Releases

hxn 0.3.1

Choose a tag to compare

@github-actions github-actions released this 14 Nov 19:49

The README links its logo, guides and examples by absolute URL, so they load
on the hxn haxelib's page. Nothing else changed since 0.3.0.

hxn 0.3.0

Choose a tag to compare

@github-actions github-actions released this 14 Nov 19:16

hxn now generates one set of Haxe classes for a library, and every runtime
uses that set. Each library gets one native class, HxnNative, whose
members are declared with plain Haxe types. At compile time, the hxn.Native
macro implements that class for the target, HashLink or hxcpp. A CPPIA
script compiles against the same classes as its host. Regenerate each
library with this version, because classes that 0.2.0 generated do not work
with it.

The Haxe classes that hxn itself provides now ship as the hxn haxelib,
published with this release. A package that hxn package writes no longer
contains a copy of these classes. It depends on the hxn haxelib at the
version of hxn that wrote the package, so the hxn libraries in one program
share the haxelib. Delete the hxn/ directory from a package that 0.2.0 wrote
before packaging it again, because an old copy there takes precedence over
the haxelib.

Packaging:

  • The haxelib key under [package.metadata.hxn] names the library's own
    haxelib. The native library keeps the library's name.
  • link.xml includes the libraries that rustc lists for the hxcpp archive,
    such as a system framework that a crate links with #[link]. It leaves out
    libc, libm, libSystem and the MSVC C runtimes.
  • When a build script links a library from its own directory, such as the
    import library that the windows crate ships, that library is copied into
    the package beside link.xml.
  • HashLink bindings build for Android and iOS through Ash. They build as an
    archive, and Ash links the archive into the program.
  • hxn::package!("name") puts a library's classes in a Haxe package.
  • A build script can write part of the API to OUT_DIR, and hxn reads it from
    there.

Types:

  • Bindings support tuples, sets, enum keys in maps, and Rust defaults for
    record fields.
  • A stream can fail with a typed error.
  • A future or stream can carry a batch of objects.
  • A lent callback can use i64.
  • hxn_future::together gives the host changes made together as one.

Behaviour changes:

  • The name of every HashLink primitive starts with its library's name.
  • Generated members start with hxn, so they do not collide with a library's
    own members. A class name that would shadow a Haxe top-level type is an
    error.
  • A weighed object checks the memory meter before each method call.
  • If a library depends on a different hxn version from the hxn command that
    builds it, the build stops with an error that names the hxn dependency or
    the hxn command to use.
  • A method that returns bytes returns empty bytes, never null. This includes
    stock HashLink, which receives an empty Vec as a null pointer.

hxn 0.2.0

Choose a tag to compare

@github-actions github-actions released this 12 Nov 20:22

Binding C libraries

  • hxn import <header.h> creates a Rust library crate for a C library. clang
    reads the header into a WebIDL file you review and edit, and the Rust
    bindings are generated from it on every build. sqlite3's own header imports
    and runs unedited.
  • Imported: opaque objects with their free functions, enums, structs by value
    and by pointer, text, outputs written through a pointer, borrowed objects,
    callbacks lent for a call, and callbacks C keeps, which become a stream of
    their calls.
  • Bytes with a length of any integer type, buffers C writes into, and text or
    bytes C keeps and frees with a destructor, as in sqlite3_bind_text.
  • Functions the linked library does not define are left out, and the system
    libraries it links are linked into hxcpp programs.

Rust libraries

  • &mut [u8] parameters: the library writes into the Haxe Bytes passed.
  • Vec<T> of objects as a return value, an Array in Haxe.
  • An object taken by value as a parameter, which closes the Haxe object.
  • Future<Option<T>> and Stream<Option<T>> of objects.

Runtimes

  • A panic becomes a thrown error on every runtime, including Ash wasm and
    hxcpp through Emscripten. hxn run cpp --wasm no longer needs a nightly
    toolchain.
  • hxn builds against hxcpp from git, after HaxeFoundation/hxcpp#1298, which
    fixed a crash on exit after a collection on Windows. hxn doctor warns
    about an older hxcpp.

Changes that need a rebuild

  • Every symbol a binding exports now starts with hxn_, so it cannot take
    the name of a C function the library links. Haxe code is unchanged.
  • HashLink primitives that can throw are extern "C-unwind".

The hxn command is attached below, built for Linux (static), macOS and
Windows, on x86-64 and ARM. Check an archive against SHA256SUMS.