Frommi / miniz_oxide

Rust replacement for miniz
MIT License
168 stars 48 forks source link

Generate miniz.h with cbindgen for C export automatically #60

Open oyvindln opened 4 years ago

oyvindln commented 4 years ago

The internal compressor/decompressor structs do not match the layout of the C versions, so we want to generate headers with the correct layout rather than using the C headers for the original library. The C zip tests/functions segfault at the moment as the decompressor structure is put on the stack, and the init function in C is just a macro that zeroes a value.

CBindgen currently doesn't handle function pointers and boxes inside options (Whcih can be exported to c as pointers). Need to either be fixed upstream, or we will want to use raw pointers here which means a bit more unsafety.