rogersce / cnpy

library to read/write .npy and .npz files in C/C++
MIT License
1.31k stars 300 forks source link

Remove zlib dependency, MSVC compatbilty #67

Open sayan1an opened 3 years ago

sayan1an commented 3 years ago

Could you please add an optional #ifdef to avoid zlib dependency for those looking to use only uncompressed npy save/load? There is no need for zlib.h for just *.npy files.

Something like:

#define CNPY_UNCOMPRESSED_ONLY //Disable compressed archive functionality and zlib dependency
#include "cnpy.h" 

Also for MSVC users, the use of fopen, scanf/sprintf causes compiler issues. Adding the #pragma warning(disable:4996) fixes the problem, but it is recommended to replace these unsafe functions with the safer versions.

sayan1an commented 3 years ago

I wonder if the project is still active, the last commit was 2 years ago!

grau4 commented 3 years ago

Same problem here. Did you have any success with removing the zlib dependency? @sayan1an

sayan1an commented 3 years ago

@grau4 I ended up removing all *.npz functionality by removing all functions which required zlib. It's fairly simple.