xaynet-mobile

Crates.ioxaynet-mobile
lib.rsxaynet-mobile
version0.1.0
sourcesrc
created_at2021-01-18 11:15:18.735181
updated_at2021-01-18 11:15:18.735181
descriptionThe Xayn Network project is building a privacy layer for machine learning so that AI projects can meet compliance such as GDPR and CCPA. The approach relies on Federated Learning as enabling technology that allows production AI applications to be fully privacy compliant.
homepagehttps://xaynet.dev/
repositoryhttps://github.com/xaynetwork/xaynet/
max_upload_size
id343466
size104,855
Xayn AG (Admin) (xayn-admin)

documentation

README

Xaynet FFI

Generate C-Header File

ffi-support provides some helpful macros to reduce boilerplate code. However the feature (--pretty=expanded) to expand these macros during the generation of the C-header file is still unstable. Therefore we need to use the rust nightly.

To generate the header files, install cbindgen and run:

cargo build
RUSTUP_TOOLCHAIN=nightly cbindgen \
    --config cbindgen.toml \
    --crate xaynet-mobile \
    --output xaynet_ffi.h

Run tests

macOS

cc -o tests/ffi_test.o -Wl,-dead_strip -I. tests/ffi_test.c ../target/debug/libxaynet_mobile.a -framework Security -framework Foundation
./tests/ffi_test.o

Linux

gcc \
    tests/ffi_test.c
    -Wall \
    -I. \
    -lpthread -lm -ldl \
    ../target/debug/libxaynet_mobile.a \
    -o tests/ffi_test.o
./tests/ffi_test.o

To check for memory leaks, you can use Valgrind:

valgrind --tool=memcheck  --leak-check=full --show-leak-kinds=all -s ./tests/ffi_test.o
Commit count: 2776

cargo fmt