One might get a C structure A, and its constructor make_A() and destructor free_A(A*). In ffi, we can bind them by ffi/unsafe, but how to let GC handle A's instance and tell GC calls free_A when unused?
1 Like
See ffi/unsafe/alloc.
For an example use, see the libcairo bindings.
2 Likes