Situation: I have many gzipped input files that I want to process in a c program. I can extract each of them each time i need them but this takes a lot of time, so I would like to use in memory extraction. As a test case i downloaded the zlib sources from http://zlib.net/ and tried to compile the example zpipe.c
Problem: When I compile zpipe.c using:
x86_64-w64-mingw32-gcc -Wall -O3 zpipe.c -o zpipe -L. -lzlib1
I get the error:
x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ./zlib1.dll when searching for -lzlib1
x86_64-w64-mingw32/4.5.4/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzlib1
What I think is the problem (I got this from Skipping incompatible error when linking)
I try to link a 32 bit dll while I compile in 64 bit code. When i look at http://zlib.net/zlib_faq.html#faq26 it is said that zlib is tested on 64 bit machines, but I guess this means you still compile 32 bit code. Note that I compile zpipe.c (provided in the zlib source), so i'm sure the inclusions are all ok. I put the zlib1.dll in the compilation directory.
What did I do/find: Among others I found 2 good examples (however with both of them I have the problem described above)
- http://www.codeguru.com/cpp/cpp/algorithms/compression/article.php/c11735
- http://bobobobo.wordpress.com/2008/02/23/how-to-use-zlib/
And I looked at other questions, such as:
- Trying to compile program that uses zlib. Link unresolved error
- Skipping Incompatible Libraries at compile
I also build a dll myself in vc 2010, however, all project configurations in the zlib 1.26 source are for a 32 bit configuration. So after I build a dll, I have the same error as above.
A long story so a quick summary of my questions:
- Is there something I do wrong during compilation?
- Is it correct that I will never be able to use the zlib1 dll when I compile in 64 bit?
- And most important: Can I somehow compile a 64 bit version of zlib myself (using for example these http://msdn.microsoft.com/en-us/library/9yb4317s.aspx instructions), or are these already available somewhere (I was not able to find these until now)?
Thank you all for your time!