### B.10 WIN32 Notes

#### B.10.1 Getting the WIN32 version

The native Aspell/WIN32 port is no longer being maintained. The best way to get Aspell for Windows is to use the MSYS2 binaries. MSYS2 is available at https://www.msys2.org/.

Binaries for Aspell 0.50 are still available at http://aspell.net/win32/ but they are no longer supported. If you are interested in updating them for Aspell 0.60 please let me know.

#### B.10.2 Building the WIN32 version

There are two basically different ways of building Aspell using GCC for WIN32: You can either use the Cygwin compiler, which will produce binaries that depend on the POSIX layer in `cygwin1.dll`. The other way is using MinGW GCC, those binaries use the native C runtime from Microsoft (MSVCRT.DLL).

#### B.10.2.1 Building Aspell using Cygwin

This works exactly like on other POSIX compatible systems using the ‘`./configure && make && make install`’ cycle. Some versions of Cygwin GCC will fail to link, this is caused by an incorrect `libstdc++.la` in the `/lib` directory. After removing or renaming this file, the build progress should work (GCC-2.95 and GCC-3.x should work).

#### B.10.2.2 Building Aspell using MinGW

There are several different ways to build Aspell using MinGW. The easiest way is to use a Cygwin compiler but instruct it to build a native binary rather than a Cygwin one. To do this configure with:

    ./configure CFLAGS='-O2 -mno-cygwin' CXXFLAGS='-O2 -mno-cygwin'

You may also want to add the option `--enable-win32-relocatable` to use more windows friendly directories. See Win32-Directories. In this case configure with:

    ./configure CFLAGS='-O2 -mno-cygwin' CXXFLAGS='-O2 -mno-cygwin' --enable-win32-relocatable

It should also be possible to build Aspell using the MSYS environment. But this has not been very well tested. If building with MSYS do not add ‘`CFLAGS …`’ to configure.

#### B.10.2.3 Building Aspell without using Cygwin or MSYS

It is also possible to build Aspell without Cygwin of MinGW by using the files in the `win32/` subdirectory. However, these files have not been updated to work with Aspell 0.60. Thus the following instructions will not work without some effort. If you do get Aspell to compile this way please send me the updated files so that I can include them with the next release.

To compile Aspell with the MinGW compiler, you will need at least GCC-3.2 (as shipped with MinGW-2.0.3) and some GNU tools like `rm` and `cp`. The origin of those tools doesn’t matter, it has shown to work with any tools from MinGW/MSys, Cygwin or Linux. To build Aspell, move into the `win32` subdirectory and type ‘`make`’. You can enable some additional build options by either commenting out the definitions at the head of the Makefile or passing those values as environment variables or at the `make` command line. Following options are supported:

`DEBUGVERSION`

  If set to "1", the binaries will include debugging information (resulting in a much bigger size).

`CURSESDIR`

  Enter the path to the pdcurses library here, in order to get a nicer console interface (see below).

`MSVCLIB`

  Enter the filename of MS `lib.exe` here, if you want to build libraries that can be imported from MS Visual C++.

`WIN32_RELOCATABLE`

  If set to "1", Aspell will detect the prefix from the path where the DLL resides (see below for further details).

`TARGET`

  Sets a prefix to be used for cross compilation (e.g. `/usr/local/bin/i586-mingw32msvc-` to cross compile from Linux).

There are also a MinGW compilers available for Cygwin and Linux, both versions are able to compile Aspell using the prebuilt `Makefile`. While the Cygwin port automatically detects the correct compiler, the Linux version depends on setting the `TARGET` variable in the `Makefile` (or environment) to the correct compiler prefix.

Other compilers may work. There is a patch for MS Visual C++ 6.0 available at ftp://ftp.gnu.org/gnu/aspell, but it needs a lot of changes to the Aspell sources. It has also been reported that the Intel C++ compiler can be used for compilation.

#### B.10.3 (PD)Curses

In order to get the nice full screen interface when spell checking files, a curses implementation that does not require Cygwin is required. The PDCurses (http://pdcurses.sourceforge.net) implementation is known to work, other implementations may work however they have not been tested. See the previous section for information on specifying the location of the curses library and include file.

Curses notes:

- PDcurses built with MinGW needs to be compiled with `-DPDC_STATIC_BUILD` to avoid duplicate declaration of `DllMain` when compiling `aspell.exe`.
- The curses enabled version can cause trouble in some shells (MSys `rxvt`, `emacs`) and will produce errors like ‘`initscr() LINES=1 COLS=1: too small`’. Use a non-curses version for those purposes.

#### B.10.4 Directories

If Aspell is configured with `--enable-win32-relocatable` or compiled with `WIN32_RELOCATABLE=1` when using a Makefile, it can be run from any directory: it will set `prefix` according to its install location (assuming it resides in `prefix\\bin`). Your personal wordlists will be saved in the `prefix` directory with their names changed from `.aspell.lang.*` to `lang.*` (you can override the path by setting the `HOME` environment variable).

#### B.10.5 Installer

The installer registers the DLLs as shared libraries, you should increase the reference counter to avoid the libraries being uninstalled if your application still depends on them (and decrease it again when uninstalling your program). The reference counters are located under:

    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs

The install location and version numbers are stored under

    HKLM\SOFTWARE\Aspell

#### B.10.6 WIN32 consoles

The console uses a different encoding than GUI applications, changing this to to a Windows encoding (e.g. 1252) is not supported on Win9x/Me. On WinNT (and later) those codepages can be set by first changing the console font to ‘`lucida console`’, then changing the codepage using ‘`chcp 1252`’.

Some alternative shells (e.g. MSys’ `rxvt` or Cygwin’s `bash`) do a codepage conversion (if correctly set up), so running Aspell inside those shells might be a workaround for Win9x.