]> piware.de Git - learn-rust.git/commit
Call Rust function from C: Complex cases
authorMartin Pitt <martin@piware.de>
Fri, 27 Aug 2021 12:49:22 +0000 (14:49 +0200)
committerMartin Pitt <martin@piware.de>
Fri, 27 Aug 2021 12:51:54 +0000 (14:51 +0200)
commit8c240f514e17c9a935f5f392e6a87779ae1c09e8
treeb2feb5f219ac11be52cfd22c5cc03d17d05515aa
parent7ed2d982ac15df78e852fd5835d137881536a4ef
Call Rust function from C: Complex cases

Add three functions which take/return strings and string arrays. This
creates some interesting problems how to combine the C semantics of
returning a char** with the Rust semantics of freeing objects once they
go out of scope.

This now also relies on the Rust standard library, which needs a few
system libraries. Link them.
call-rust-from-c/Makefile
call-rust-from-c/src/lib.rs
call-rust-from-c/src/main.c