From 582c91839db934979a108965ba4fd50655368d38 Mon Sep 17 00:00:00 2001 From: KarolisP Date: Wed, 17 Jul 2024 11:51:05 +0300 Subject: [PATCH] Added define guard for internal ffi structs which caused redefinition errors when including multiple UniFFI c++ libraries in the same project Signed-off-by: KarolisP --- bindgen/src/bindings/cpp/templates/scaffolding.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bindgen/src/bindings/cpp/templates/scaffolding.hpp b/bindgen/src/bindings/cpp/templates/scaffolding.hpp index c6b4175..97c1fba 100644 --- a/bindgen/src/bindings/cpp/templates/scaffolding.hpp +++ b/bindgen/src/bindings/cpp/templates/scaffolding.hpp @@ -6,6 +6,8 @@ extern "C" { #endif +#ifndef UNIFFI_CPP_INTERNALSTRUCTS +#define UNIFFI_CPP_INTERNALSTRUCTS struct ForeignBytes { int32_t len; uint8_t *data; @@ -22,6 +24,8 @@ struct RustCallStatus { RustBuffer error_buf; }; +#endif + typedef int ForeignCallback(uint64_t handle, uint32_t method, uint8_t *args_data, int32_t args_len, RustBuffer *buf_ptr); {% for func in ci.iter_ffi_function_definitions() %}