json-c library
Translating json-c
# in examples/json-c/repo:
../configure # use the custom c2rust configure script
intercept-build make
make check
python3 ../translate.py
ninja -C rust
This will produce rust/libjson-c.so.4.0.0
.
Running tests
# in examples/json-c/repo:
# Replace the C libjson-c.so with a symlink to the Rust one.
# You only need to do this the first time.
rm .libs/libjson-c.so.4.0.0
ln -s ../rust/libjson-c.so.4.0.0 .libs/libjson-c.so.4.0.0
# Run tests
make check
If you modify the C files, make check
will try to rebuild some stuff and thenwill break because of the object files that translate.py
deleted. If thishappens, run make clean && make
, then repeat the "running tests" steps fromthe top.