3. Windows
Prev | Chapter 2. Compilation and Installation | Next

## 3. Windows

The easiest way to install YAZ on Windows is by downloading an installer from Index Data's Windows support area . The installer comes with source too - in case you wish to compile YAZ with different compiler options, etc.

### 3.1. Compiling from Source on Windows

YAZ is shipped with "makefiles" for the NMAKE tool that comes with Microsoft Visual Studio. It has been tested with Microsoft Visual Studio 2017.

Start a command prompt and switch the sub directory `WIN` where the file `makefile` is located. Customize the installation by editing the `makefile` file (for example by using notepad). The following summarizes the most important settings in that file:

`DEBUG`

  If set to 1, the software is compiled with debugging libraries (code generation is multi-threaded debug DLL). If set to 0, the software is compiled with release libraries (code generation is multi-threaded DLL).

`HAVE_TCL`, `TCL`

  If `HAVE_TCL` is set to 1, nmake will use the ASN.1 compiler (Tcl based). You must set `TCL` to the full path of the Tcl interpreter. A Windows version of Tcl is part of Git for Windows.

  If you do not have Tcl installed, set `HAVE_TCL` to 0.

`HAVE_BISON`, `BISON`

  If GNU Bison is present, you might set `HAVE_BISON` to 1 and specify the Bison executable in `BISON`. Bison is only required if you use the Git version of YAZ or if you modify the grammar for CQL (`cql.y`).

  A Windows version of GNU Bison can be fetched from here: Index Data's Windows support area .

`HAVE_ICONV`, `ICONV_DIR`

  If `HAVE_ICONV` is set to 1, YAZ is compiled with iconv support. In this configuration, set `ICONV_DIR` to the iconv source directory.

`HAVE_LIBXML2`, `LIBXML2_DIR`

  If `HAVE_LIBXML2` is set to 1, YAZ is compiled with SRU support. In this configuration, set `LIBXML2_DIR` to the libxml2 source directory.

  You can get pre-compiled Libxml2+Libxslt DLLs and headers from here. Should you with to compile those libraries yourself, refer to to Section 3.3, “Compiling Libxml2 and Libxslt on windows”

`HAVE_LIBXSLT`, `LIBXSLT_DIR`

  If `HAVE_LIBXSLT` is set to 1, YAZ is compiled with XSLT support. In this configuration, set `LIBXSLT_DIR` to the libxslt source directory.

  ### Note

  libxslt depends on libxml2.

`HAVE_ICU`, `ICU_DIR`

  If `HAVE_ICU` is set to 1, YAZ is compiled with ICU support. In this configuration, set `ICU_DIR` to the ICU source directory.

  Pre-compiled ICU libraries for various versions of Visual Studio can be found here or from Index Data's Windows support site.

When satisfied with the settings in the makefile, type

          nmake

### Note

If the `nmake` command is not found on your system you probably haven't defined the environment variables required to use that tool. To fix that, find and run the batch file `vcvarsall.bat`. You need to run it from within the command prompt or set the environment variables "globally"; otherwise it doesn't work.

If you wish to recompile YAZ - for example if you modify settings in the `makefile` you can delete object files, etc by running.

          nmake clean

The following files are generated upon successful compilation:

`bin/yaz5.dll` / `bin/yaz5d.dll`

  YAZ Release/Debug DLL.

`lib/yaz5.lib` / `lib/yaz5d.lib`

  Import library for `yaz5.dll` / `yaz5d.dll`.

`bin/yaz_cond5.dll` / `bin/yaz_cond5d.dll`

  Release/Debug DLL for condition variable utilities (condvar.c).

`lib/yaz_cond5.lib` / `lib/yaz_cond5d.lib`

  Import library for `yaz_cond5.dll` / `yaz_cond5d.dll`.

`bin/yaz_icu5.dll` / `bin/yaz_icu5d.dll`

  Release/Debug DLL for the ICU wrapper utility. Only build if HAVE_ICU is 1.

`lib/yaz_icu5.lib` / `lib/yaz_icu5d.lib`

  Import library for `yaz_icu5.dll` / `yaz_icu5d.dll`.

`bin/yaz-ztest.exe`

  Z39.50 multi-threaded test/example server. It's a WIN32 console application.

`bin/yaz-client.exe`

  YAZ Z39.50 client application. It's a WIN32 console application. See chapter YAZ client for more information.

`bin/yaz-icu.exe`

  This program exposes the ICU wrapper library if that is enabled for YAZ. Only if ICU is available this program is built.

`bin/zoomsh.exe`

  Simple console application implemented on top of the ZOOM functions. The application is a command line shell that allows you to enter simple commands to perform ZOOM operations.

`bin/zoomtst1.exe`, `bin/zoomtst2.exe`, ..

  Several small applications that demonstrate the ZOOM API.

### 3.2. How to make apps using YAZ on Windows

This section will go though the process of linking your Windows applications with YAZ.

Some people are confused by the fact that we use the nmake tool to build YAZ. They think they have to do that too - in order to make their Windows applications work with YAZ. The good news is that you don't have to. You can use the integrated environment of Visual Studio if desired for your own application.

When setting up a project or Makefile you have to set the following:

include path

  Set it to the `include` directory of YAZ.

import library `yaz5.lib`

  You must link with this library. It's located in the sub directory `lib` of YAZ. If you want to link with the debug version of YAZ, you must link against `yaz5d.lib` instead.

dynamic link library `yaz5.dll`

  This DLL must be in your execution path when you invoke your application. Specifically, you should distribute this DLL with your application.

### 3.3. Compiling Libxml2 and Libxslt on windows

Download libxml2 and Libxslt source and unpack it. In the example below we install Libxml2 2.9.2 and Libxslt 1.1.28 for 32-bit, so we use the destination directories libxml2.2.9.2.win32 and libxslt-1.1.28.win32 to reflect both version and architecture.

          cd win32
          cscript configure.js prefix=c:\libxml2-2.9.2.win32 iconv=no
          nmake
          nmake install

### Note

There's an error in `configure.js` for Libxml2 2.9.2. Line 17 should be assigned to `configure.ac` rather than `configure.in`.

For Libxslt it is similar. We must ensure that compilation of Libxslt links against the already installed libxml2.

          cd win32
          cscript configure.js prefix=c:\libxslt-1.1.28.win32 iconv=no \
              lib=c:\libxml2-2.9.2.win32\lib \
    	  include=c:\libxml2-2.9.2.win32\include\libxml2
          nmake
          nmake install

Prev | Up | Next
2. UNIX/MacOS | Home | Chapter 3. ZOOM