Post in https://github.com/nim-lang/zip/issues/6
import xmlparser,xmltree, zip/zipfiles
echo "parsing xlsx"
let path = "example.xlsx"
var za:ZipArchive
var suc = za.open(path)
if not suc:
echo("fail to open " & path )
else:
echo "file opened!"
let ss = za.getStream("xl/sharedStrings.xml")
let root = xmlparser.parseXml(ss)
echo kind(root)
I download zlib128-dll (http://zlib.net/zlib128-dll.zip),and try to compile using gcc (64bit) :
nim c --cincludes:D:\DEV\C++\zlib128-dll\include --clib:D:\DEV\C++\zlib128-dll\lib\zdll ziptest.nim
or
nim c --cincludes:D:\DEV\C++\zlib128-dll\include --clib:D:\DEV\C++\zlib128-dll\lib\zdll.lib ziptest.nim
or
nim c -t:-m32 -l:-m32 --cpu:i386 --cincludes:D:\DEV\C++\zlib128-dll\include --clib:D:\DEV\C++\zlib128-dll\lib\zdll ziptest.nim
or
nim c -t:-m32 -l:-m32 --cpu:i386 --cincludes:D:\DEV\C++\zlib128-dll\include --clib:D:\DEV\C++\zlib128-dll\lib\zdll.lib ziptest.nim
link error:
D:/DEV/TDMGCC/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lD:\DEV\C++\zlib128-dll\lib\zdll collect2.exe: error: ld returned 1 exit status
At last ,I got done, it's the way:
It seems that you have to build under 32bit options with GCC , link to the lib use -l:LIB ,not --clib:LIB
nim c --cincludes:zlib\include -l:zlib1.dll --cpu:i386 -t:-m32 -l:-m32 -t:-DWIN32 ziptest.nim
If you'are on the windows32bit, --cpu:i386 -t:-m32 -l:-m32 -t:-DWIN32 is not necessary.
Before building on windows , you have to comment three lines in privatelibzip_all.c
//#define HAVE_FSEEKO 1 --line 276
//#define HAVE_FTELLO 1 --line 279
//#define HAVE_MKSTEMP 1 --line 291