Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling zlib for windows mobile 6

I am trying to compile zlib for Windows Mobile in Visual Studio 2008.

However, that leads to an error. In the file zconf.h there is inclusion of the file sys/types.h.

While this file is in thw standard visual studio include directory, folder ce/include that comes with windows mobile sdk does not have sys subfolder in it, and it doesn't have types.h file here.

Consequently, zlb does not compile.

How should that be resolved?

Update: include itself is in the #if block. To be specific:

#ifdef STDC
#  ifndef Z_SOLO
#    include <sys/types.h>      /* for off_t */
#  endif
#endif

That brings to another question. Just what is the meaning of Z_SOLO macro? It is littered in #ifdef's and like in zlib, but searching for it doesn't give a clue about what is should be. It is not defined, by the way.

like image 623
Srv19 Avatar asked Oct 17 '12 08:10

Srv19


2 Answers

Z_SOLO is used to compile and use zlib without the use of any external libraries. It is for use in embedded environments. There are no gz* functions and several other functions that depend on memory allocation are also taken out (compress(), uncompress()). The base zlib initialization functions (e.g. deflateInit()) must be provided memory allocation functions. This will avoid all of the problems you are having with Windows Mobile not having the standard C library headers and functions.

In order to use Z_SOLO you need to edit zconf.h to have a #define Z_SOLO near the beginning. Then compile zlib and use it with the edited zconf.h. (If you only compile with Z_SOLO, but do not edit zconf.h, then you'll get messed up with you try to use the compiled zlib with the header files.)

like image 178
Mark Adler Avatar answered Sep 28 '22 06:09

Mark Adler


You could just go get the source, complete with Studio project files, that I put out in CodePlex.

like image 38
ctacke Avatar answered Sep 28 '22 06:09

ctacke