feat: add cbindgen to livekit-ffi (#57)

This commit is contained in:
Théo Monnom
2023-05-08 23:33:02 +02:00
committed by GitHub
parent 1c12e749f2
commit 8dd7979d04
3 changed files with 29 additions and 2 deletions
+4
View File
@@ -0,0 +1,4 @@
language = "C"
include_guard = "livekit_ffi"
autogen_warning = "/* Warning, this file is autogenerated. Don't modify this manually. */"
usize_is_size_t = true
+23
View File
@@ -0,0 +1,23 @@
#ifndef livekit_ffi
#define livekit_ffi
/* Warning, this file is autogenerated. Don't modify this manually. */
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
typedef size_t FfiHandleId;
#define INVALID_HANDLE 0
FfiHandleId livekit_ffi_request(const uint8_t *data,
size_t len,
const uint8_t **res_ptr,
size_t *res_len);
bool livekit_ffi_drop_handle(FfiHandleId handle_id);
#endif /* livekit_ffi */
+2 -2
View File
@@ -31,7 +31,7 @@ pub type FfiHandle = Box<dyn Any + Send + Sync>;
pub const INVALID_HANDLE: FfiHandleId = 0;
#[no_mangle]
pub(crate) extern "C" fn livekit_ffi_request(
pub extern "C" fn livekit_ffi_request(
data: *const u8,
len: usize,
res_ptr: *mut *const u8,
@@ -69,7 +69,7 @@ pub(crate) extern "C" fn livekit_ffi_request(
}
#[no_mangle]
pub(crate) extern "C" fn livekit_ffi_drop_handle(handle_id: FfiHandleId) -> bool {
pub extern "C" fn livekit_ffi_drop_handle(handle_id: FfiHandleId) -> bool {
// Free the memory
server::FFI_SERVER
.ffi_handles()