File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
## rust-clib
2
2
3
+ An example project that uses Rust to create a library with C API.
4
+
3
5
Build rust lib and run C tests
4
6
```
5
7
(cd mylib && cargo build)
@@ -8,13 +10,13 @@ make test
8
10
9
11
successful output looks like this:
10
12
```
11
- Compiling add v0.1 .0 (~/src/rust/clib/mylib)
13
+ Compiling add v0.2 .0 (~/src/rust/clib/mylib)
12
14
Finished dev [unoptimized + debuginfo] target(s) in 4.21s
13
15
cp mylib/target/debug/libmylib.a .
14
16
gcc libmylib.a -o test test.o libmylib.a
15
17
./test
16
18
PASSED
17
- Tests run: 2
19
+ Tests run: 4
18
20
```
19
21
20
22
@@ -27,10 +29,11 @@ Tests run: 2
27
29
28
30
## The Rust part
29
31
30
- in the ` add ` directory is a Rust crate
32
+ in the ` my ` directory is a Rust crate, which has tests along with a very
33
+ simple example that calls a function from Rust (that is also callable from C)
31
34
32
35
```
33
- cd add
36
+ cd mylib
34
37
cargo test # test that we can call the function in Rust
35
38
cargo run --example stdin # interactive example
36
39
```
You can’t perform that action at this time.
0 commit comments