README.MSVC6
1To compile zziplib with MSVC++ 6 you can use the workspace and project
2files shipped along with the zziplib tarball in the msvc6/ directory.
3This will save you most of the following steps, atleast skip step 1.
4
5Step 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
24Step 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
51Step 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
79Step 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
100Step 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
114cheers, -- guido
115
116# finally, the older description for zziplib 0.10.5x
117
118To build zziplib you need to add the path to zlib to the include directories
119search path. You find this under
120
121 Project, Settings, C/C++, Preprocessor, Additional Include Directories.
122
123Example:
124You have installed zlib to D:\zlib. You then change the edit box
125 Additional Include Directories
126from
127 ..
128to
129 ..,D:\zlib
130
131
132Included are two project files for zziplib. One that creates
133zziplib as a DLL, and one that creates zziplib as a static library.
134The DLL version is compiled with multi-threaded support. The static library
135version is currently set to link with libc(d).lib, i.e. only single-threaded
136CRT. If this does not suit your needs, you can change this under
137 Project, Settings, C/C++, Code Generation, Use run-time library.
138
README.SDL
1WARNING:
2 The following instructions are outdated.
3 They refer back to 16. Dezember 2002 with zziplib version 0.10.66.
4 Most things refer to MSVC which have a different README
5 (and there are msvc project files being shipped along)
6 The rest is mainly an example program that you can use as a
7 boilerplate in your souce code - may be just copy and use.
8
9---------------------------------------------------------------------
1016122002, Thomas.Eder@nmi.at, Using the zziplib library with SDL
11
12
13PREREQUISITES
14
15 Tested versions:
16 zziplib 0.10.66 (preview), SDL 1.2.5, Win32, MSVC6
17
18 Homepages (download)
19 zziplib.sourceforge.net (zziplib-0.10.66.tar.gz)
20 www.libsdl.org (SDL-devel-1.2.5a-VC6.zip)
21
22 Also you have to get zlib, I used
23 from SDL_image-1.2.2.zip in VisualC.zip:
24 zlib.lib (12.7.1998, 34674 bytes)
25 zlib.h ( 9.7.1998, 41791 bytes, 1.1.3)
26 zconf.h ( 8.7.1998, 8089 bytes)
27
28 from SDL_image-devel-1.2.2-VC6.zip:
29 zlib.dll ( 5.4.2001, 53760 bytes, 1.1.3.1)
30
31 Maybe you should get the latest version (currently 1.1.4) from
32 http://gnuwin32.sourceforge.net/install.html
33 (see notes at end of page!)
34
35
36CREATING zzlib.dll/zzlib.lib
37
38 Copy your versions of zlib.lib, zlib.h and zconf.h to the zzlib
39 directory.
40 In MSVC (start zziplib.dsw)
41 Add zlib.lib to the files for the zziplib_DLL project.
42 Add ZLIB_DLL to the preprocessor definitions.
43
44 Set the active project and the active configuration to create zziplib.dll
45 and zziplib.lib (I created and used the release version).
46
47
48USING zzlib WITH SDL
49
50 Include/add the following files to your SDL-Project
51 (put them in proper directories, etc.):
52
53 Header files:
54 zconf.h
55 zlib.h
56 zzip.h
57 zzip-conf.h
58 zzip-io.h
59 zziplib.h
60 zzip-msvc.h
61 zzip-stdint.h
62
63 Libraries:
64 zlib.lib
65 zziplib.lib
66
67 DLLs:
68 zlib.dll
69 zziplib.dll
70
71 you may also want to use
72 SDL_rwops_zzip.c
73 SDL_rwops_zzip.h
74
75
76 For compiling it should be sufficient to use
77 #include <zziplib.h>
78 in the files where you use zziplib-functions.
79
80
81NOTE
82
83 It is possible to use both original (unzipped) and zipped versions of files,
84 and zziplib will take one of them (depending on the modes when calling
85 zziplib).
86
87 But this didn't work for all of my original files, so I suggest using zipped
88 files only (and remove the original unzipped files, so zziplib doesn't try to
89 open the original version).
90
91
92HINT
93
94 When opening many files from a zip, its faster to open the zip-directory
95 only once, and not for every file access. You may want to modify
96 SDL_rwops_zzip for this to get code like:
97
98
99 SDL_Surface* image;
100 SDL_RWops* rw;
101 SDL_Surface* temp1 = NULL; //default > NULL > error
102 SDL_Surface* temp2 = NULL; //default > NULL > error
103
104 //last param may be used for err return
105 ZZIP_DIR* zzipdir = zzip_dir_open( "figures.zip", NULL );
106
107 ZZIP_FILE* zfile = zzip_file_open(zzipdir, "f1.bmp", ZZIP_CASELESS);
108
109 if (zfile)
110 {
111 rw = SDL_RWFromZZIP(zfile); //modified version
112 if (rw)
113 {
114 temp1 = IMG_Load_RW(rw, 0);
115 SDL_FreeRW(rw);
116 }
117 int zret = zzip_file_close( zfile );
118 }
119
120 zfile = zzip_file_open(zzipdir, "f2.bmp", ZZIP_CASELESS);
121 if (zfile)
122 {
123 rw = SDL_RWFromZZIP(zfile); //modified version
124 if (rw)
125 {
126 temp2 = IMG_Load_RW(rw, 0);
127 SDL_FreeRW(rw);
128 }
129 int zret = zzip_file_close( zfile );
130 }
131
132 //.. etc
133
134 zzip_dir_close( zzipdir );
135