COMPILING YAP UNDER WIN32 (WIN95, WIN98, NT, 2000)

Yap should compile under both cygwin and Visual C++ 6.0. We next describe
how to do it from scratch.

$YAPSRC is the directory where you can find the sources
$YAPVERSION  is the current version for YAP.

GCC-Based compilation:

GCC is distributed in the MINGW32 and CYGWIN packages.

The Mingw32 environment is available from the URL:

@code{http://www.mingw.org}

You will need to install the @code{msys} and @code{mingw}
packages. You should be able to do configure, make and make install.

If you use mingw32 you may want to search the contributed packages for
the @code{gmp} multi-precision arithmetic library. If you do setup Yap
with @code{gmp} note that @code{libgmp.dll} must be in the path,
otherwise Yap will not be able to execute.

CygWin environment is available from the URL:

@code{http://www.cygwin.com}

@noindent
and mirrors. We suggest using recent versions of the cygwin shell. The
compilation steps under the cygwin shell are as follows:

@example
mkdir cyg
$YAPSRC/configure --enable-coroutining \\
                  --enable-depth-limit \\
                  --enable-max-performance
make
make install
@end example

By default, Yap will use the @code{--enable-cygwin=no} option to
disable the use of the cygwin dll and to enable the mingw32 subsystem
instead. Yap thus will not need the cygwin dll. It instead accesses
the system's @code{CRTDLL.DLL} @code{C} run time library supplied with
Win32 platforms through the mingw32 interface. Note that some older
WIN95 systems may not have @code{CRTDLL.DLL}, in this case it should
be sufficient to import the file from a newer WIN95 or WIN98 machine.

You should check the default installation path which is set to
@code{/PROGRA~1/Yap} in the standard Makefile. This string will usually
be expanded into @code{c:\Program Files\Yap} by Windows.

The cygwin environment does not provide @t{gmp}. You can fetch a dll for
the @t{gmp} library from @url{http://www.sf.net/projects/mingwrep}.

It is also possible to configure Yap to be a part of the cygwin
environment. In this case you should use:
@example
mkdir cyg
$YAPSRC/configure --enable-coroutining \\
                  --enable-max-performance \\
                  --enable-cygwin=yes
make
make install
@end example
Yap will then compile using the cygwin library and will be installed
in cygwin's @code{/usr/local}. You can use Yap from a cygwin console,
or as a standalone application as long as it can find
@code{cygwin1.dll} in its path.

VISUAL C++:

To the best of my knowledge, Yap compiles cleanly under VC++ release
6.0.

First, it is a good idea to build Yap as a DLL:

1. create a project named yap using File.New. The project will be a
DLL project, initially *empty*.

NOTICE: Either the project is named yap or you must replace
YAP_EXPORTS to match your project names in c_interface.h and
c_interface.c.

o Use the FileView tab to add all .c files in the $YAPSRC/C directory
and in the $YAPSRC/OPTYap directory to the "Source Files".

o add all .h files in the $YAPSRC/H directory, $YAPSRC/include directory and in the $YAPSRC/OPTYap subdirectory to the "Header Files".

o include the .h from .m4 files and config.h. You can find these files at $YAPSRC/VC/include.

o You may want to go to Build.Set Active Configuration and set Project Type to Release

o set Project.Settings.C/C++.Preprocessor.Additional Include Directories to include the $YAPSRC/H, $YAPSRC/VC/include, $YAPSRC/OPTYap and $YAPSRC/include.

The syntax is:

$YAPSRC\H, $YAPSRC\VC\include, $YAPSRC\OPTYap, $YAPSRC\include

o Build: the system should generate an yap.dll and an yap.lib.

o Copy the yapdll.dll file to your path. The yapdll.lib should be copied to
where the linker can find it (you can also give the explicit path).

2. create a second project  say wyap with File.New. The project will be a
WIN32 console project, initially empty.

o add $YAPSRC/console/yap.c to the Source Files.

o add $YAPSRC/VC/include/config.h and the files in $YAPSRC/include/ to
the Header Files.

o You may want to go to Build.Set Active Configuration and set Project Type to Release

o you will eventually need to bootstrap the system by booting from
boot.yap, so write:

	-b $YAPSRC\pl\boot.yap

	in Project.Project Settings.Debug.Program Arguments

o You need the sockets and yap libraries. Add

ws2_32.lib yapdll.lib to

to

Project.Project Settings.Link.Object/Library Modules

You may also need to set the Link Path so that VC++ will find yap.lib.

o set Project.Project Settings.C/C++.Preprocessor.Additional Include Directories to include the $YAPSRC/VC/include and $YAPSRC/include.

The syntax is:

$YAPSRC\VC\include, $YAPSRC\include

o Build the system.

o Use Build.Start Debug to boot the system, and then create the saved state with

['$YAPSRC\\pl\\init'].
save_program('startup.yss').
^Z

That's it, you've got YAP and the saved state!

The $YAPSRC\VC directory has the make files to build Yap4.3.17 under VC++ 6.0.

Problems with this release:

	o alarm/3 does not work in WIN98. This seems to be a limitation of WIN98.
	o signals still do not work properly with console applications :-(.
	o ??


Enjoy!

Vitor