Back to Comprehensive Rust

Calling Rust

src/android/interoperability/with-c/rust.md

latest534 B
Original Source
<!-- Copyright 2022 Google LLC SPDX-License-Identifier: CC-BY-4.0 -->

Calling Rust

We can now call this from a C binary:

interoperability/rust/libanalyze/analyze.h

c
{{#include rust/libanalyze/analyze.h:analyze_numbers}}

interoperability/rust/analyze/main.c

c
{{#include rust/analyze/main.c:main}}

interoperability/rust/analyze/Android.bp

javascript
{{#include rust/analyze/Android.bp}}

Build, push, and run the binary on your device:

shell
{{#include ../../build_all.sh:analyze_numbers}}