kuba-- / zip

A portable, simple zip library written in C
MIT License
1.42k stars 276 forks source link

miniz.h: surround function definitions with an #ifdef #339

Closed crudelios closed 8 months ago

crudelios commented 8 months ago

This is the last one, I promise.

Right now, if you want to include miniz.h outside of zip.h, you'll run into linker errors due to duplicate definitions.

The solution is rather easy: place an #ifdef MINIZ_IMPLEMENTATION right before miniz's function definitions and then, in zip.c, add an #define MINIZ_IMPLEMENTATION right before including miniz.h.

kuba-- commented 8 months ago

Frankly, I do not want to modify miniz (if it's possible), because any upgrade becomes harder. If I understand correctly, you want to include different miniz in your project (additionally)?

crudelios commented 8 months ago

Frankly, I do not want to modify miniz (if it's possible), because any upgrade becomes harder.

Fair enough.

If I understand correctly, you want to include different miniz in your project (additionally)?

Not quite. I hate code duplication, so I wanted to use the same miniz header both for your zip library and for libspng (and also directly as a drop-in replacement for zlib).

I only managed to do it by adding the define mentioned above.

This is a very specific issue, so feel free to close it if you want.