miniz_oxide icon indicating copy to clipboard operation
miniz_oxide copied to clipboard

Make C API layout-compatible with miniz

Open Shnatsel opened this issue 5 years ago • 2 comments

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.

Shnatsel avatar Jun 06 '20 15:06 Shnatsel

Ah nice.

oyvindln avatar Jun 07 '20 17:06 oyvindln

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.)

oyvindln avatar Nov 11 '21 16:11 oyvindln