]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Drop `#[no_mangle]` from `*_write_void` to make cbindgen not export
authorMatt Corallo <git@bluematt.me>
Mon, 16 Oct 2023 01:35:28 +0000 (01:35 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 16 Oct 2023 01:35:28 +0000 (01:35 +0000)
cbindgen recently switched to exporting all `#[no_mangle]` and
`extern "C"` functions. Our `*_write_void` methods are
internal-only but we'd marked them `#[no_mangle]`, which resulted
in them spuriously appearing in `lightning.h`.

c-bindings-gen/src/main.rs

index 22eabf7affbb53fdfb7c47a863fd4db9232e37ed..6853534624427a7b0a5fcb8295f8b4999254e672 100644 (file)
@@ -95,7 +95,6 @@ fn maybe_convert_trait_impl<W: std::io::Write>(w: &mut W, trait_path: &syn::Path
 
                                writeln!(w, "}}").unwrap();
                                if has_inner {
-                                       writeln!(w, "#[no_mangle]").unwrap();
                                        writeln!(w, "pub(crate) extern \"C\" fn {}_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {{", for_obj).unwrap();
                                        writeln!(w, "\tcrate::c_types::serialize_obj(unsafe {{ &*(obj as *const native{}) }})", for_obj).unwrap();
                                        writeln!(w, "}}").unwrap();