json-c library

Translating json-c

  1. # in examples/json-c/repo:
  2. ../configure # use the custom c2rust configure script
  3. intercept-build make
  4. make check
  5. python3 ../translate.py
  6. ninja -C rust

This will produce rust/libjson-c.so.4.0.0.

Running tests

  1. # in examples/json-c/repo:
  2. # Replace the C libjson-c.so with a symlink to the Rust one.
  3. # You only need to do this the first time.
  4. rm .libs/libjson-c.so.4.0.0
  5. ln -s ../rust/libjson-c.so.4.0.0 .libs/libjson-c.so.4.0.0
  6. # Run tests
  7. 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.