| 1 |
To compile zziplib with MSVC++ 6 you can use the workspace and project |
| 2 |
files shipped along with the zziplib tarball in the msvc6/ directory. |
| 3 |
This will save you most of the following steps, atleast skip step 1. |
| 4 |
|
| 5 |
Step 1: create zziplib workspace file |
| 6 |
|
| 7 |
- Create a workspace and a project file for "zzip". |
| 8 |
- Add all .c and .h files in the zzip/ directory. Yes, all. |
| 9 |
- Add the toplevel directory (containing the zzip/ directory) as an |
| 10 |
"Additional Include Directory" to the search path. Best do this in |
| 11 |
-> Project -> Settings -> Tab: C/C++ |
| 12 |
-> Category: Preprocessor -> "Additional Include Directories". |
| 13 |
This is a comma-separated list, in the workspace files shipped along |
| 14 |
with the zziplib tarball, you will see ".." in there where ".." (or ..\..) |
| 15 |
is the path to the toplevel directory of the unpacked sources. |
| 16 |
- if you did choose "DLL" as a project type then you will automatically |
| 17 |
see a define _USRDLL and ZZIP_EXPORTS in (this is just a hint)... |
| 18 |
-> Project -> Settings -> Tab: C/C++ |
| 19 |
-> Category: Preprocessor -> "Preprocessor Definitions". |
| 20 |
- remove any LIB imports other than "kernel32.lib" |
| 21 |
-> Project -> Settings -> Tab: Link |
| 22 |
-> Category: Input -> "Object/Library Modules" |
| 23 |
|
| 24 |
Step 2: add zlib dependencies of zziplib.dll |
| 25 |
|
| 26 |
- if you do not have installed zlib in the system then you may want to |
| 27 |
download "lib" + "bin" parts from http://gnuwin32.sf.net/packages/zlib.htm |
| 28 |
(I found this msvcrt package via a reference at http://www.zlib.org) |
| 29 |
- suppose you have the zlib.h file in "D:\include" and the libz.lib file |
| 30 |
is in "D:\lib" then we need to add those dependencies to the project. |
| 31 |
- add the path to zlib.h as an "Additional Include Path", best do this in |
| 32 |
-> Project -> Settings -> Tab: C/C++ |
| 33 |
-> Category: Preprocessor -> "Additional Include Directories". |
| 34 |
This is a comma-separated list, after you have changed it, it might |
| 35 |
look like "..,.,D:\include" (for ".." part see description in Step 1) |
| 36 |
- That is enough to build a zziplib.lib, in order to create a zziplib.dll |
| 37 |
we need to resolve its linker dependencies as well, best do this in |
| 38 |
-> Project -> Settings -> Tab: Link |
| 39 |
-> Category: Input -> "Object/Library Modules" |
| 40 |
This is a space separated list (!!), add "libz.lib" there, so after |
| 41 |
changing it it might look like "kernel32.lib libz.lib". Also modify |
| 42 |
-> Project -> Settings -> Tab: Link |
| 43 |
-> Category: Input -> "Additional Library Path" |
| 44 |
which is usually empty. After changing it, it might contain "D:\lib". |
| 45 |
- Also add ZZIP_DLL or ZZIP_EXPORTS for dllspec(exports), best do this in |
| 46 |
-> Project -> Settings -> Tab: C/C++ |
| 47 |
-> Category: Preprocessor" -> "Preprocessor Definitions". |
| 48 |
After changing it, it might look like |
| 49 |
"NDEBUG,WIN32,_WINDOWS,_MBCS,_USRDLL,ZZIP_EXPORTS" |
| 50 |
|
| 51 |
Step 3: example binaries to link with zziplib.dll |
| 52 |
|
| 53 |
- dynamic linking is best to avoid any copyright problems, the "Lesser GPL" |
| 54 |
does not restrict usage of zziplib for the case of a separated zzip.dll |
| 55 |
- the example workspace builds two zziplib libraries, where zziplib.lib |
| 56 |
points to the staticlink variant and zzip.lib to the dynalink variant |
| 57 |
which will add a dependency on zzip-1.dll being in the PATH |
| 58 |
- the example binaries shipped with zziplib tarball do only have a single |
| 59 |
.c file per output .exe, we pick zzcat.exe to guide you through. |
| 60 |
- if you do not use our shipped project files, create a project "zzcat" |
| 61 |
and add "bins/zzcat.c" in there. |
| 62 |
- adjust the "Additional Include Directories": |
| 63 |
-> Project -> Settings -> Tab: C/C++ |
| 64 |
-> Category: Preprocessor -> "Additional Include Directories". |
| 65 |
like in Step 1 add the path to "./zzip" owning the zziplib headers. |
| 66 |
We do _not_ need the zlib headers to compile "zzcat.exe", so it might |
| 67 |
just look like ".." (or "..\.." or "..\zziplib-0.10.82") |
| 68 |
- adjust the "Object/Library Modules" |
| 69 |
-> Project -> Settings -> Tab: Link |
| 70 |
-> Category: Input -> "Object/Library Modules" |
| 71 |
adding "zzip.lib libz.lib" with a space. The result might look like |
| 72 |
"kernel32.lib zzip.lib libz.lib" or "kernel32.lib zziplib.lib libz.lib". |
| 73 |
- adjust the "Additional Library Path" |
| 74 |
-> Project -> Settings -> Tab: Link |
| 75 |
-> Category: Input -> "Additional Library Path" |
| 76 |
and add both zziplib libpath and libz libpath, separated by comma, i.e. |
| 77 |
".\Release,D:\lib" or ".\Debug,D:\lib" |
| 78 |
|
| 79 |
Step 4: Customization |
| 80 |
- have a look at the info parts that can be put into the DLL project: |
| 81 |
-> Project -> Settings -> Tab: Link |
| 82 |
-> Category: Output -> "Version Information" |
| 83 |
e.g. Major: "10" Minor: "82" for Release 0.10.82 of zziplib |
| 84 |
-> Project -> Settings -> Tab: Resources -> "Language" |
| 85 |
or just ignore the value when no messages are there |
| 86 |
-> Project -> Settings -> Tab: Link |
| 87 |
-> Category: General -> "Output Filename" |
| 88 |
e.g. "zzip-1.dll" instead of "zzip.dll" for this first generation |
| 89 |
(needs also to rename dll dependencies from "zzip.lib" to "zzip-1.lib") |
| 90 |
- there are a few defines that trigger extra code in zziplib, e.g. |
| 91 |
ZZIP_HARDEN - extra sanity check for obfuscated zip files |
| 92 |
ZZIP_CHECK_BACKSLASH_DIRSEPARATOR - to check for win32-like paths |
| 93 |
(for the magic part within a zip archive we always assume a "/" separator) |
| 94 |
ZZIP_USE_ZIPLIKES - not only do magic checks for ".zip" files to |
| 95 |
be handled like directories, also do that for a few other zip documents |
| 96 |
ZZIP_WRAPWRAP - if there problems on unusual targets then try this one. |
| 97 |
-> Project -> Settings -> Tab: C/C++ |
| 98 |
-> Category: Preprocessor" -> "Preprocessor Definitions". |
| 99 |
|
| 100 |
Step 5: Testing |
| 101 |
- copy the *.dll and *.exe files from msvc6/Release/ to a place reachable |
| 102 |
from your PATH (perhaps d:\bin), or even simpler, go the other way round, |
| 103 |
copy the file test/test.zip to the msvc6/Release/ directory. |
| 104 |
- open a command window (usually with a "MSDOS" symbol) and go the |
| 105 |
directory containing the test.zip (e.g. cd zziplib-0.10.82/msvc6/Release) |
| 106 |
- run `zzcat test/README` which should extract the file README from the |
| 107 |
test.zip archive and print it to the screen. Try `zzdir test` to see |
| 108 |
that it was really a compressed file printed to the screen. |
| 109 |
- If it works then everything is alright round zziplib which is a good |
| 110 |
thing to know when there are other problems |
| 111 |
- at the time of writing (0.10.82 of zziplib), the set of bin files are |
| 112 |
precompiled with msvc6 and pushed to the download center at sourceforge. |
| 113 |
|
| 114 |
cheers, -- guido |
| 115 |
|
| 116 |
# finally, the older description for zziplib 0.10.5x |
| 117 |
|
| 118 |
To build zziplib you need to add the path to zlib to the include directories |
| 119 |
search path. You find this under |
| 120 |
|
| 121 |
Project, Settings, C/C++, Preprocessor, Additional Include Directories. |
| 122 |
|
| 123 |
Example: |
| 124 |
You have installed zlib to D:\zlib. You then change the edit box |
| 125 |
Additional Include Directories |
| 126 |
from |
| 127 |
.. |
| 128 |
to |
| 129 |
..,D:\zlib |
| 130 |
|
| 131 |
|
| 132 |
Included are two project files for zziplib. One that creates |
| 133 |
zziplib as a DLL, and one that creates zziplib as a static library. |
| 134 |
The DLL version is compiled with multi-threaded support. The static library |
| 135 |
version is currently set to link with libc(d).lib, i.e. only single-threaded |
| 136 |
CRT. If this does not suit your needs, you can change this under |
| 137 |
Project, Settings, C/C++, Code Generation, Use run-time library. |