Frommi / miniz_oxide

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

Make C API layout-compatible with miniz #79

Open Shnatsel opened 4 years ago

Shnatsel commented 4 years ago

The README mentions that exporting miniz-compatible headers is blocked on an upstream cbindgen issue. However, a workaround for that issue was devised: https://github.com/eqrion/cbindgen/issues/326#issuecomment-584288686

So it should be possible to export layout-compatible structures once again.

oyvindln commented 4 years ago

Ah nice.

oyvindln commented 2 years ago

I've now used the workaround and using cbindgen-exported headers, and as of d235075a20b9c43f7a8187eab443d0221e272fc6 miniz C and C++ test stuff compiles with it.

Not yet sure if the compress/decompress structs should be only offered as opaque or not, seems some projects put them on the stack (i.e one of the examples) or manually allocate them which means they have to be defined and contain pointers to internal states.

(Also needed to include time.h in miniz_zip.h for the examples and one used miniz_tinfl.h instead of the full miniz.h.)