How to include uzlib? It's on Github, but...

I would like to uncompress some zlib compressed data, and it appears uzlib on github will work. However, it is a bunch of C files (not cpp) that compile down to a .a library file (unix style lib, I'm on OSX).

Can anyone tell me how to do one of the following:

a) Integrate a library like this into the Arduino IDE build, or
b) Include a bunch of C files

I tried to #include the source files but because they are old C with old declspec style, even extern "C" didn't work. So how include "old" format C in my project?

Here are the source files. Any guidance on how to include them would be greatly accepted. For once you've got all the code, so an answer should be easy :slight_smile:

Thanks!
Dave

I don't know about your question in general, but with the latest IDE version it is possible to use .a files in Arduino libraries. You need to add a library.properties file in the library root folder and in that file set the precompiled property to true. More information here:

Thanks for the info on .a files, I’ll check that out!

For now, I managed to get it all working with extern"C" and a few bug fixes to the lib. At least I got it compiling, working might take longer!

extern “C” {
#include “uzlib/src/uzlib.h”
#include “uzlib/src/adler32.c”
#include “uzlib/src/crc32.c”
#include “uzlib/src/defl_static.c”
#include “uzlib/src/genlz77.c”
#include “uzlib/src/tinfgzip.c”
#include “uzlib/src/tinflate.c”
#include “uzlib/src/tinfzlib.c”
}

Renaming .c to .cpp is another solution.