\section{Technical Problems}

\subsection{SWI-Prolog}

Using PAKCS with SWI-Prolog as its back end is slower than
SICStus-Prolog and might cause some memory problems,
since SWI-Prolog has stronger restrictions on the memory limits
for the different stack areas when executing Prolog programs.
For instance, if the compiled Curry program terminates
with an error message like
\begin{curry}
ERROR: local
\end{curry}
the Prolog system runs out of the local stack (although there
might be enough memory available on the host machine).

To avoid such problem, one can try to modify the script
\begin{curry}
$\cyshome$/scripts/pakcs-makesavedstate.sh
\end{curry}
in order to change the SWI-Prolog default settings
for memory limits of generated Curry applications
and before installing the system by \ccode{make}.\footnote{%
Note that this script is generated
during the installation of \CYS. Hence, it might be necessary
to redo the changes after a new installation of \CYS.}
To change the actual memory limits, one should change
the definition of the variable
\code{SWILIMITS} at the beginning of this script.
Since different versions of SWI-Prolog have different command-line options,
the correct setting depends on the version of SWI-Prolog:
\begin{description}
\item[SWI-Prolog 7.*:]
For instance, to set the maximum limit for
the local stack to 4 GB (on 64bit machines, the default of SWI-Prolog
is 1 GB), one change the definition in this script to
\begin{curry}
SWILIMITS="-L4G -G0 -T0"
\end{curry}
\item[SWI-Prolog 8.*:]
For instance, to use 8 GB for all stacks
(on 64bit machines, the default of SWI-Prolog is 1 GB),
one change the definition in this script to
\begin{curry}
SWILIMITS="--stack_limit=8g"
\end{curry}
\end{description}
%
After this change, recompile (with the \CYS command \ccode{:save})
the Curry application.


\subsection{Distributed Programming and Sockets}

If Curry is used to implement distributed systems
with the package \code{cpns},\footnote{%
\url{https://www-ps.informatik.uni-kiel.de/~cpm/pkgs/cpns.html}}
it might be possible that some technical problems
arise due to the use of sockets for implementing these
features. Therefore, this section gives some information
about the technical requirements of \CYS and how to solve
problems due to these requirements.

There is one fixed port that is used by the implementation of \CYS:
\begin{description}
\item[Port 8769:] This port is used by the
{\bf Curry Port Name Server} (CPNS) to implement symbolic names for
named sockets in Curry (see package \code{cpns}).
If some other process uses this port on the machine,
the distribution facilities defined in the the package \code{cpns}
%module \code{Ports} (see Appendix~\ref{sec-ports})
cannot be used.
\end{description}
If these features do not work, you can try to find out
whether this port is in use by the shell command
\ccode{netstat -a | grep 8769} (or similar).

The CPNS is implemented as a demon listening on its port 8767
in order to serve requests about registering a new symbolic
name for a Curry port or asking the physical port number
of a Curry port. The demon will be automatically started for
the first time on a machine when a user compiles a program
using Curry ports.
It can also be manually started and terminated by the
command \code{curry-cpnsd} (which is available by installing
the package \code{cpns}, e.g., by the command \ccode{cypm install cpnsd})
If the demon is already running,
the command \ccode{curry-cpnsd start}
does nothing (so it can be always executed
before invoking a Curry program using ports).

\subsection{Contact for Help}

If you detect any further technical problem,
please write to
\begin{center}
\code{pakcs@curry-lang.org}
\end{center}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "manual"
%%% End: 
