Skip to content

Conversation

@pjotrp
Copy link

@pjotrp pjotrp commented Oct 29, 2025

Added shared library as output, i.e.

make libagc_so

Also fixes C ABI:

  1. Prevent C++ exceptions to bleed through the C ABI which causes Rust bindings to fail by handling 'noexcept'
  2. Added missing agc_string_destroy in ABI

@pjotrp
Copy link
Author

pjotrp commented Oct 29, 2025

Note I create Rust bindings linked against libagc.so:

=> https://github.com/pjotrp/libagc-sys

See also the included test in lib.rs. It binds against the updated agc:

=> main...pjotrp:agc:main

which contains the fixes that don't allow C++ exceptions to pass through the C ABI.
Also I fixed one function and added a shared lib as output.

Finally, rather than messing with the impg code tree (which keeps changing), I created a test crate that mirrors impg:

=> https://github.com/pjotrp/testlibagc

which can be build and run with

cargo build --release
target/release/testagc-sys
Number of samples: 4

At least we have a reference implementation for binding successfully against a shared C library with a very light and standardised interface. It obviously also works in Guix. We can use it to benchmark against the new (impressive) Rust implementation by Erik. It also acts as a template for future bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant