Skip to content

CGlue 0.2.0

Compare
Choose a tag to compare
@h33p h33p released this 26 Nov 03:35
· 74 commits to main since this release
c214dd1

Changes in 0.2.0:

Rework code generation:

  • Make code generator emit C functions that take in a single object that contains both the object and the return context. This simplifies usage from C/C++.

  • Remove zero wrapper optimization. The above is incompatible with it.

  • Remove CtxBox, as context has been moved into the container object.

Context is now always Clone + Send + Sync.

Ergonomic C/C++ wrappers:

  • In C++ trait objects and groups have member functions and destructors defined. Trait objects and groups themselves are ABI-incompatible when passed by value.

  • In C there are inline functions for invoking behavior. Some of the functions accept void pointers, because they are compatible with multiple variations of the same CGlue object.

  • Ability to specify default container and context types, so that the wrappers become more compact.

  • Manual cleanup is no longer supported as bindgen has become more complex.

Somewhat tested with miri:

  • Stacked borrows are disabled.

  • ABI checks have been patched out, because otherwise rust evaluator does not accept type erasure.

Vtable-only functions:

  • Provide Rust functionality in C/C++ with slightly different types.

Wrap strings and slices in return types.

Unstable feature to auto-impl groups:

  • Auto-enables the widest set of optional traits for any given type.

  • Makes cglue_impl_group! a no-op.

Runtime ABI/API validation with abi_stable.

Remove no_empty_retwrap feature.

Replace CArc with COptArc, make old CArc private:

  • COptArc was always the prefered choice, as it allowed to also represent None in the same amount of space.