1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>SWI-Prolog for MS-Windows</title>
<style type="text/css">
/* Style sheet for SWI-Prolog latex2html
*/
dd.defbody
{ margin-bottom: 1em;
}
dt.pubdef, dt.multidef
{ color: #fff;
padding: 2px 10px 0px 10px;
margin-bottom: 5px;
font-size: 18px;
vertical-align: middle;
overflow: hidden;
}
dt.pubdef { background-color: #0c3d6e; }
dt.multidef { background-color: #ef9439; }
.bib dd
{ margin-bottom: 1em;
}
.bib dt
{ float: left;
margin-right: 1.3ex;
}
pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}
div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}
div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}
div.author
{ text-align: center;
font-style: italic;
}
div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}
div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}
div.toc-h1
{ font-size: 200%;
font-weight: bold;
}
div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}
div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}
div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}
span.sec-nr
{
}
span.sec-title
{
}
span.pred-ext
{ font-weight: bold;
}
span.pred-tag
{ float: right;
padding-top: 0.2em;
font-size: 80%;
font-style: italic;
color: #fff;
}
div.caption
{ width: 80%;
margin: auto;
text-align:center;
}
/* Footnotes */
.fn {
color: red;
font-size: 70%;
}
.fn-text, .fnp {
position: absolute;
top: auto;
left: 10%;
border: 1px solid #000;
box-shadow: 5px 5px 5px #888;
display: none;
background: #fff;
color: #000;
margin-top: 25px;
padding: 8px 12px;
font-size: larger;
}
sup:hover span.fn-text
{ display: block;
}
/* Lists */
dl.latex
{ margin-top: 1ex;
margin-bottom: 0.5ex;
}
dl.latex dl.latex dd.defbody
{ margin-bottom: 0.5ex;
}
/* PlDoc Tags */
dl.tags
{ font-size: 90%;
margin-left: 5ex;
margin-top: 1ex;
margin-bottom: 0.5ex;
}
dl.tags dt
{ margin-left: 0pt;
font-weight: bold;
}
dl.tags dd
{ margin-left: 3ex;
}
td.param
{ font-style: italic;
font-weight: bold;
}
/* Index */
dt.index-sep
{ font-weight: bold;
font-size: +1;
margin-top: 1ex;
}
/* Tables */
table.center
{ margin: auto;
}
table.latex
{ border-collapse:collapse;
}
table.latex tr
{ vertical-align: text-top;
}
table.latex td,th
{ padding: 2px 1em;
}
table.latex tr.hline td,th
{ border-top: 1px solid black;
}
table.frame-box
{ border: 2px solid black;
}
</style>
</head>
<body style="background:white">
<div class="title">SWI-Prolog for MS-Windows</div>
<div class="author">Jan Wielemaker <br>
VU University Amsterdam <br>
University of Amsterdam <br>
The Netherlands <br>
E-mail: <a class="url" href="mailto:jan@swi-prolog.org">jan@swi-prolog.org</a></div>
<div class="abstract">
<div class="abstract-title">Abstract</div> This document gets you
started using SWI-Prolog on MS-Windows. It also describes the components
and issues that are specific to MS-Windows. It is by no means a manual
or Prolog tutorial. The reference manual is available online or can be
downloaded in HTML and PDF format from the <a class="url" href="http://www.swi-prolog.org/">SWI-Prolog
website</a>, which also provides links to books, online tutorials and
other Prolog-related material.
</div>
<h1><a id="document-contents">Table of Contents</a></h1>
<div class="toc">
<div class="toc-h2"><a class="sec" href="#sec:1"><span class="sec-nr">1</span> <span class="sec-title">Using
SWI-Prolog</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:1.1"><span class="sec-nr">1.1</span> <span class="sec-title">Starting
Prolog and loading a program</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:1.2"><span class="sec-nr">1.2</span> <span class="sec-title">Executing
a query</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:1.3"><span class="sec-nr">1.3</span> <span class="sec-title">Menu
commands</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:1.4"><span class="sec-nr">1.4</span> <span class="sec-title">Editing
Prolog programs</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:1.5"><span class="sec-nr">1.5</span> <span class="sec-title">Some
useful commands</span></a></div>
<div class="toc-h2"><a class="sec" href="#sec:2"><span class="sec-nr">2</span> <span class="sec-title">Using
SWI-Prolog with C/C++</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:2.1"><span class="sec-nr">2.1</span> <span class="sec-title">Using
MSVC</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:2.2"><span class="sec-nr">2.2</span> <span class="sec-title">Using
swipl-ld.exe</span></a></div>
<div class="toc-h2"><a class="sec" href="#sec:3"><span class="sec-nr">3</span> <span class="sec-title">The
installation</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:3.1"><span class="sec-nr">3.1</span> <span class="sec-title">Supported
Windows versions</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:3.2"><span class="sec-nr">3.2</span> <span class="sec-title">Choosing
the file extension</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:3.3"><span class="sec-nr">3.3</span> <span class="sec-title">Installed
programs</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:3.4"><span class="sec-nr">3.4</span> <span class="sec-title">Installed
Registry keys and menus</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:3.5"><span class="sec-nr">3.5</span> <span class="sec-title">Execution
level</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:3.6"><span class="sec-nr">3.6</span> <span class="sec-title">Creating
a desktop menu item</span></a></div>
<div class="toc-h2"><a class="sec" href="#sec:4"><span class="sec-nr">4</span> <span class="sec-title">The
SWI-Prolog community and foundation</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:4.1"><span class="sec-nr">4.1</span> <span class="sec-title">Website
and mailing lists</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:4.2"><span class="sec-nr">4.2</span> <span class="sec-title">About
license conditions</span></a></div>
<div class="toc-h3"><a class="sec" href="#sec:4.3"><span class="sec-nr">4.3</span> <span class="sec-title">Supporting
SWI-Prolog</span></a></div>
</div>
<h2><a id="sec:1"><span class="sec-nr">1</span> <span class="sec-title">Using
SWI-Prolog</span></a></h2>
<p>
<h3><a id="sec:1.1"><span class="sec-nr">1.1</span> <span class="sec-title">Starting
Prolog and loading a program</span></a></h3>
<p>The SWI-Prolog executable <b>swipl-win.exe</b> can be started from
the
<em>StartMenu</em> or by opening a <code>.pl</code> file holding Prolog
program text from the Windows explorer.<sup class="fn">1<span class="fn-text">The
.PL file extension can be changed during installation. See <a class="sec" href="#sec:3.2">section
3.2</a>.</span></sup> The installation folder (by default
<code>C:\Program Files\swipl</code>) contains a subfolder
<code>demo</code> with the file <code>likes.pl</code>. This file can be
opened in Prolog from the StartMenu, by opening <code>likes.pl</code> in
the Windows explorer or by using the following command in the Prolog
application. Be sure to get the quotes right and terminate the command
with a full stop (<code><code>.</code></code>).
<pre class="code">
?- [swi('demo/likes')].
</pre>
<p>If Prolog is started from the start menu it is passed the option
<code>--win_app</code>, which causes it to start in the local equivalent
of
<code>MyDocuments\Prolog</code>. This folder is created if it does not
exist.
<p><h3 id="sec:execquery"><a id="sec:1.2"><span class="sec-nr">1.2</span> <span class="sec-title">Executing
a query</span></a></h3>
<a id="sec:execquery"></a>
<p>After loading a program, one can ask Prolog queries about the
program. The query below asks Prolog what food `sam' likes. The system
responds with <code>X = <<var>value</var>></code> if it can prove
the goal for a certain
<var>X</var>. The user can type the semi-colon (;) or spacebar. If you
want another solution. Use the <span style="font-variant:small-caps">return</span>
key if you do not want to see the more answers. Prolog completes the
output a full stop (.) if the user uses the <span style="font-variant:small-caps">return</span>
key or Prolog <em>knowns</em> there are no more answers. If Prolog
cannot find (more) answers, it writes
<b>false.</b> Finally, Prolog can answer using an error message to
indicate the query or program contains an error.
<pre class="code">
?- likes(sam, X).
X = dahl ;
X = tandoori ;
...
X = chips.
?-
</pre>
<p>Note that the answer written by Prolog is a valid Prolog program
that, when executed, produces the same set of answers as the original
program.
<p><h3 id="sec:menu"><a id="sec:1.3"><span class="sec-nr">1.3</span> <span class="sec-title">Menu
commands</span></a></h3>
<a id="sec:menu"></a>
<p>The SWI-Prolog console provided by <b>swipl-win.exe</b> has a menu
for accessing the most commonly used commands. We assume not all menu
entries need to be explained in detail. We make some exceptions:
<dl class="latex">
<dt><b>File/Reload modified files</b></dt>
<dd class="defbody">
This menu reloads all loaded source files that have been modified using
the <a id="idx:make0:1"></a><a class="pred" href="#make/0">make/0</a>
command described in <a class="sec" href="#sec:1.5">section 1.5</a>.</dd>
<dt><b>File/Navigator ...</b></dt>
<dd class="defbody">
Opens an explorer-like view on Prolog files and the predicates they
contain.</dd>
<dt><b>Settings/Font ...</b></dt>
<dd class="defbody">
Allows for changing the font of the console. On some installations the
default font gives redraw and cursor dislocation problems. In this case
you may wish to select an alternative. Some built-in commands assume
non-proportional fonts.</dd>
<dt><b>Settings/User init file ...</b></dt>
<dd class="defbody">
Edits the user personalisation file. If no such file exists, it first
installs a default file as <code>swipl.ini</code> that contains commonly
used settings in comments.</dd>
<dt><b>Settings/Stack sizes ...</b></dt>
<dd class="defbody">
Allows for defining the maximum size to which the various Prolog stacks
are allowed to grow. The system defaults are chosen to make erroneous
programs fail quickly on modest hardware. Programs with large data
structures or many choice points often need larger stacks. Note that an
active Prolog process growing over the size of the physical memory of
your computer can make the system extremely slow.</dd>
<dt><b>Run/Interrupt</b></dt>
<dd class="defbody">
Try to interrupt the running Prolog process. This is the same as using <em>Control-C</em>.
Sometimes interrupts are not honoured or take very long to process.
Closing the window twice provides a way to force Prolog to stop.</dd>
<dt><b>Run/New thread</b></dt>
<dd class="defbody">
Creates a new interactor window running in a separate thread of
execution. This may be used to inspect the database or program while the
main task continues.</dd>
<dt><b>Debug/Edit spy points ...</b></dt>
<dd class="defbody">
Edit break points on predicates. From the PceEmacs editor (see
<a class="sec" href="#sec:1.4">section 1.4</a>) break points can also be
set on specific calls from specific clauses.</dd>
<dt><b>Debug/Graphical debugger ...</b></dt>
<dd class="defbody">
Use the source-level debugger on the next spy or break point or other
call that enables the debugger.</dd>
<dt><b>Help</b></dt>
<dd class="defbody">
The help menu provides various starting points to related documents.
Items flagged with <b>(on www)</b> open your default internet browser on
a page of the SWI-Prolog website.
</dd>
</dl>
<p><h3 id="sec:edit"><a id="sec:1.4"><span class="sec-nr">1.4</span> <span class="sec-title">Editing
Prolog programs</span></a></h3>
<a id="sec:edit"></a>
<p>There are three options for editing. One is to run an editor of
choice in a separate window and use the <a id="idx:make0:2"></a><a class="pred" href="#make/0">make/0</a>
command described below to reload modified files. In addition to this
option Prolog can be used to locate predicates, modules and loaded files
by specifying the editor of choice for use with the <a id="idx:edit1:3"></a><a class="pred" href="#edit/1">edit/1</a>
command, described below. This is achieved by editing the
personalisation file (see <a class="sec" href="#sec:1.3">section 1.3</a>)
and following the instructions in the comments.
<p>The default editor is the built-in editor called <em>PceEmacs</em>.
This editor provides colourisation support based on real-time parsing
and cross-reference analysis of the program.
<p>Other options for editing include GNU-Emacs, SWI-Prolog-Editor and
the Eclipse-based PDT environment. See
<a class="url" href="http://www.swi-prolog.org/IDE.html">http://www.swi-prolog.org/IDE.html</a>
for an up-to-date overview.
<p><h3 id="sec:commands"><a id="sec:1.5"><span class="sec-nr">1.5</span> <span class="sec-title">Some
useful commands</span></a></h3>
<a id="sec:commands"></a>
<p>This section provides a very brief overview of important or commonly
used SWI-Prolog predicates to control the environment.
<dl class="latex">
<dt class="pubdef"><a id="consult/1"><strong>consult</strong>(<var>:File</var>)</a></dt>
<dd class="defbody">
Load a source file. On Windows, folders may be specified with the
DOS/Windows <code><code>\</code></code>, which must be escaped, or by
using the POSIX standard
<code><code>/</code></code>. Especially when used in source code, <code><code>/</code></code>
is to be preferred as it is portable. A Prolog list ([ ... ]) can be
used to abbreviate the consult command. The file extension (<code>.pl</code>
as well as the selected alternative) can be omitted. Here are some
examples:
<p><table class="latex frame-void center">
<tr><td><code>?- consult(likes).</code></td><td>Load <code>likes.pl</code>
from the current folder (see <a id="idx:pwd0:4"></a><a class="pred" href="#pwd/0">pwd/0</a>). </td></tr>
<tr><td><code>?- ['C:/Program Files/pl/demo/likes']</code></td><td>Load <code>likes.pl</code>
using absolute path. </td></tr>
<tr><td><code>?- ['C:<code>\</code><code>\</code>Program Files<code>\</code><code>\</code>pl<code>\</code><code>\</code>demo<code>\</code><code>\</code>likes']</code></td><td>Same
using Windows-style path name </td></tr>
</table>
</dd>
<dt class="pubdef"><a id="pwd/0"><strong>pwd</strong></a></dt>
<dd class="defbody">
Print working directory (folder).</dd>
<dt class="pubdef"><a id="ls/0"><strong>ls</strong></a></dt>
<dd class="defbody">
List files in current directory.</dd>
<dt class="pubdef"><a id="edit/0"><strong>edit</strong></a></dt>
<dd class="defbody">
If Prolog is started by opening a <code>.pl</code> file in the explorer,
edit this file. Also available from the menu.</dd>
<dt class="pubdef"><a id="edit/1"><strong>edit</strong>(<var>+Spec</var>)</a></dt>
<dd class="defbody">
Edit file, predicate, module, etc., with the given name. If multiple
items are named <var>Spec</var> it prompts for the desired alternative.</dd>
<dt class="pubdef"><a id="make/0"><strong>make</strong></a></dt>
<dd class="defbody">
Reload all files that have been changed since they were last loaded.
Normally used after editing one or more files.</dd>
<dt class="pubdef"><a id="gtrace/0"><strong>gtrace</strong></a></dt>
<dd class="defbody">
Start the graphical debugger. There are three ways to use this. Entered
as a single goal at the top level, the next query will be traced.
Alternatively it can be used in conjunction with the goal to be
debugged: <code>?- gtrace, run.</code> and finally you can include it in
your program to start tracing at a particular point or under a
particular condition:
<pre class="code">
...,
(var(X) -> gtrace ; true),
...,
</pre>
</dd>
<dt class="pubdef"><a id="trace/0"><strong>trace</strong></a></dt>
<dd class="defbody">
Same as gtrace, but text-based on the console.</dd>
<dt class="pubdef"><a id="apropos/1"><strong>apropos</strong>(<var>+Keyword</var>)</a></dt>
<dd class="defbody">
Search for all predicates that contain <var>Keyword</var> in their name
or short description. If a GUI environment is available the results are
hyperlinks. Otherwise use <a id="idx:help1:5"></a><a class="pred" href="#help/1">help/1</a>
to get details on selected hits.</dd>
<dt class="pubdef"><a id="help/1"><strong>help</strong>(<var>+Spec</var>)</a></dt>
<dd class="defbody">
Give help on <var>Spec</var>, which is normally the name of a predicate
or C interface function.
</dd>
</dl>
<p>
<h2><a id="sec:2"><span class="sec-nr">2</span> <span class="sec-title">Using
SWI-Prolog with C/C++</span></a></h2>
<p>Using <a class="url" href="http://www.mingw.org">MinGW</a> or a
compiler with a compatible calling format you can write C or C++ code
that can be loaded into SWI-Prolog and called as a predicate. You can
also embed SWI-Prolog in C/C++ applications.
<p>Details on how to interact with Prolog are in the <a class="url" href="http://www.swi-prolog.org/pldoc/refman/">SWI-Prolog
reference manual</a>. The mailing list archives and TWiki web provide
problems and solutions to the many problems that may occur.
Documentation of the <code>SWI-cpp.h</code> C++ include file is
available from the <a class="url" href="http://www.swi-prolog.org/pldoc/package/pl2cpp.html">package
documentation</a>. This section only discusses some Windows-specific
issues.
<p>
<h3><a id="sec:2.1"><span class="sec-nr">2.1</span> <span class="sec-title">Using
MSVC</span></a></h3>
<blockquote> Because the current versions of SWI-Prolog are compiled and
linked with MinGW, we are unsure about the status with regard to
compiling extensions using MSVC and embedding SWI-Prolog into MSVC
projects.
<p>Please send your comments to the SWI-Prolog mailinglist, and/or
<a class="url" href="mailto:bugs@swi-prolog.org">mailto:bugs@swi-prolog.org</a>.
</blockquote>
<p>First of all, add the <code>include</code> folder of the installation
to the search path for headers and the <code>lib</code> folder to the
search path for libraries. Both DLLs (extensions) or embedded
executables should link to
<code>libswipl.dll.a</code> and, if appropriate, to the multithreaded
DLL version of the MSVC runtime library.
<p>To create extensions, create a Win32 DLL. To embed Prolog, care
should be taken that Prolog can find the Prolog installation. For
<em>development</em>, the simplest way to ensure this is by adding the
installation <code>bin</code> folder to the <code>%PATH%</code>
environment and calling <b>PL_initialise()</b> as illustrated below. <b>PL_initialise()</b>
uses the path of the loaded <code>libswipl.dll</code> module to find the
Prolog installation folder.<sup class="fn">2<span class="fn-text">When
using the C++ interface from <code>SWI-cpp.h</code>, these comments
apply to the arguments for PlEngine().</span></sup>
<pre class="code">
{ static char *av[] = { "libswipl.dll", NULL };
if ( !PL_initialise(1, av) )
{ <error>
}
}
</pre>
<p>To create an executable that does not rely on Prolog one must create
a saved state of the required Prolog code and attach this to the
executable. Creating saved states is described with <a id="idx:qsaveprogram2:6"></a><span class="pred-ext">qsave_program/2</span>
in the reference manual. This can be attached to a state using the DOS
command below to create <code>final.exe</code> from the executable
produced by MSVC and the generated saved state.
<pre class="code">
> copy /b file.exe+file.state final.exe
</pre>
<p>
<h3><a id="sec:2.2"><span class="sec-nr">2.2</span> <span class="sec-title">Using
swipl-ld.exe</span></a></h3>
<p>The <b>swipl-ld.exe</b> automates most of the above complications and
provides compatibility for common tasks on many platforms supported by
SWI-Prolog. To use it with MinGW, set the <code>PATH</code> environment
variables to include the SWI-Prolog binary folder as well as the MinGW
binary folders (typically <code>C:\MinGW\bin</code>) to find
<b>gcc</b>. An extension <code>myext.dll</code> can be created from the
source <code>myext.c</code> using the command below. Add <code>-v</code>
to see what commands are executed by <b>swipl-ld.exe</b>.
<pre class="code">
> swipl-ld.exe -shared -o myext myext.c
</pre>
<p>An embedded executable is created from C, C++ and Prolog files using
<pre class="code">
> swipl-ld.exe -o myexe file.c ... file.pl ...
</pre>
<p>
<h2><a id="sec:3"><span class="sec-nr">3</span> <span class="sec-title">The
installation</span></a></h2>
<p><h3 id="sec:winver"><a id="sec:3.1"><span class="sec-nr">3.1</span> <span class="sec-title">Supported
Windows versions</span></a></h3>
<a id="sec:winver"></a>
<p>SWI-Prolog requiring Windows XP or later (XP, Vista, Windows-7). The
download site of SWI-Prolog contains older binaries that run on older
versions of Windows. We provide both 32-bit and 64-bit installers.
<p><h3 id="sec:ext"><a id="sec:3.2"><span class="sec-nr">3.2</span> <span class="sec-title">Choosing
the file extension</span></a></h3>
<a id="sec:ext"></a>
<p>By default, Prolog uses the <code>.pl</code> extension to indicate
Prolog source files. Unfortunately this extension conflicts with the
Perl language. If you want to use both on the same Windows machine
SWI-Prolog allows you to choose a different extension during the
installation. The extension <code>.pro</code> is a commonly used
alternative. If portability is an issue, it is advised to use the
alternative extension only for the
<em>load file</em>, the source file that loads the entire program, and
use the normal <code>.pl</code> extension for libraries and files loaded
from other files.
<p>
<h3><a id="sec:3.3"><span class="sec-nr">3.3</span> <span class="sec-title">Installed
programs</span></a></h3>
<p>The table below lists the installed components. Some components are
marked (32-bits) or (64-bits). Most of this is because the 64-bit
version is built using more recent tools and from more recent versions
of required libraries using different naming conventions. This will
probably be synchronised in the future.
<p><table class="latex frame-box center">
<tr><td colspan=2 align=center>Programs</tr>
<tr class="hline"><td><code>bin\swipl-win.exe</code> </td><td>Default
Windows application for interactive use. </td></tr>
<tr><td><code>bin\swipl.exe</code> </td><td>Console-based version for
scripting purposes. </td></tr>
<tr class="hline"><td colspan=2 align=center>Utilities</tr>
<tr class="hline"><td><code>bin\swipl-ld.exe</code> </td><td>Linker
front-end to make single-file mixed Prolog/C/C++ executables. </td></tr>
<tr><td><code>bin\swipl-rc.exe</code> </td><td>Manipulate Prolog
resource files. </td></tr>
<tr class="hline"><td colspan=2 align=center>Important directories</tr>
<tr class="hline"><td><code>bin</code> </td><td>Executables and DLL
files </td></tr>
<tr><td><code>library</code> </td><td>Prolog library </td></tr>
<tr><td><code>boot</code> </td><td>Sources for system predicates </td></tr>
<tr><td><code>include</code> </td><td>C/C++ header files for embedding
or to create extensions </td></tr>
<tr><td><code>xpce</code> </td><td>XPCE graphics system </td></tr>
<tr><td><code>xpce\prolog\lib</code> </td><td>XPCE/Prolog library </td></tr>
<tr class="hline"><td colspan=2 align=center>DLLs and other supporting
files</tr>
<tr class="hline"><td><code>boot32.prc</code> </td><td>Initial Prolog
state (32-bits) </td></tr>
<tr><td><code>boot64.prc</code> </td><td>Initial Prolog state (64-bits) </td></tr>
<tr><td><code>\bin\libswipl.dll</code> </td><td>The Prolog kernel </td></tr>
<tr><td><code>\bin\plterm.dll</code> </td><td>The window for <b>swipl-win.exe</b> </td></tr>
<tr><td><code>\bin\pthreadVC2.dll</code></td><td>POSIX thread runtime
library (64-bits) </td></tr>
<tr class="hline"><td colspan=2 align=center>Extension DLLs (plugins)</tr>
<tr class="hline"><td><code>\bin\cgi.dll</code> </td><td>Gather CGI GET
and POST arguments </td></tr>
<tr><td><code>\bin\double_metaphone.dll</code> </td><td>Soundex (sounds
similar) </td></tr>
<tr><td><code>\bin\memfile.dll</code> </td><td>In-memory temporary
`files' </td></tr>
<tr><td><code>\bin\odbc4pl.dll</code> </td><td>ODBC interface </td></tr>
<tr><td><code>\bin\plregtry.dll</code> </td><td>Windows registry
interface </td></tr>
<tr><td><code>\bin\porter_stem.dll</code> </td><td>Porter stemming
implementation </td></tr>
<tr><td><code>\bin\random.dll</code> </td><td>Portable random number
generator </td></tr>
<tr><td><code>\bin\rdf_db.dll</code> </td><td>RDF database </td></tr>
<tr><td><code>\bin\readutil.dll</code> </td><td>Fast reading utility </td></tr>
<tr><td><code>\bin\sgml2pl.dll</code> </td><td>SGML/XML parser </td></tr>
<tr><td><code>\bin\socket.dll</code> </td><td>Prolog socket interface </td></tr>
<tr><td><code>\bin\table.dll</code> </td><td>Access structured files as
tables </td></tr>
<tr><td><code>\bin\time.dll</code> </td><td>Timing and alarm library </td></tr>
<tr><td><code>\bin\xpce2pl.dll</code> </td><td>The XPCE graphics system </td></tr>
<tr><td><code>\bin\zlib1.dll</code> </td><td>Compression library
(32-bits) </td></tr>
<tr><td><code>\bin\zlibwapi.dll</code> </td><td>Compression library
(64-bits) </td></tr>
<tr><td><code>\bin\zlib4pl.dll</code> </td><td>Compression library
interface </td></tr>
</table>
<p>
<h3><a id="sec:3.4"><span class="sec-nr">3.4</span> <span class="sec-title">Installed
Registry keys and menus</span></a></h3>
<p>The filetype <code>.pl</code> or chosen alternative (see <a class="sec" href="#sec:3.2">section
3.2</a>) is associated to <b>swipl-win.exe</b>. A chosen folder (default
SWI-Prolog) is added to the start menu holding shortcuts to Prolog and
some related utilities. The following registry keys are in use. The
64-bit version uses <code>Prolog64</code> instead of <code>Prolog</code>
as a key to accommodate installation of both versions on the same
machine. Note that opening a
<code>.pl</code> file can be associated with one of the installed Prolog
versions only.
<p><table class="latex frame-box center">
<tr><td colspan=2 align=center><code>HKEY_LOCAL_MACHINE<code>\</code>Software<code>\</code>SWI<code>\</code>Prolog</code></tr>
<tr class="hline"><td><code>fileExtension</code> </td><td>Extension used
for Prolog files </td></tr>
<tr><td><code>group</code> </td><td>Start menu group </td></tr>
<tr><td><code>home</code> </td><td>Installation directory </td></tr>
<tr class="hline"><td colspan=2 align=center><code>HKEY_CURRENT_USER<code>\</code>Software<code>\</code>SWI<code>\</code>Plwin<code>\</code>Console</code></tr>
<tr><td colspan=2 align=center>Note: thread-windows store the same info
in sub-keys</tr>
<tr class="hline"><td><code>Height</code> </td><td>Height of window in
character units </td></tr>
<tr><td><code>Width</code> </td><td>Width of window in character units </td></tr>
<tr><td><code>X</code> </td><td>Left edge of window in pixel units </td></tr>
<tr><td><code>Y</code> </td><td>Top edge of window in pixel units </td></tr>
<tr><td><code>SaveLines</code> </td><td>Number of lines available for
scrollback </td></tr>
</table>
<p>
<h3><a id="sec:3.5"><span class="sec-nr">3.5</span> <span class="sec-title">Execution
level</span></a></h3>
<p>The installer asks for the <code>admin</code> execution level (Vista
and later) to be able to write shortcuts and registry keys.
<p>
<h3><a id="sec:3.6"><span class="sec-nr">3.6</span> <span class="sec-title">Creating
a desktop menu item</span></a></h3>
<p>If you want a desktop entry for SWI-Prolog, right-drag
<b>swipl-win.exe</b> to the desktop and select `Create shortcut'. Then
edit the properties and add <code>--win_app</code> to the command line
to make the application start in <code>MyDocuments\Prolog</code>.
<p>
<h2><a id="sec:4"><span class="sec-nr">4</span> <span class="sec-title">The
SWI-Prolog community and foundation</span></a></h2>
<p>
<h3><a id="sec:4.1"><span class="sec-nr">4.1</span> <span class="sec-title">Website
and mailing lists</span></a></h3>
<p>The SWI-Prolog website is located at <a class="url" href="http://www.swi-prolog.org/">http://www.swi-prolog.org/</a>.
<p>
<h3><a id="sec:4.2"><span class="sec-nr">4.2</span> <span class="sec-title">About
license conditions</span></a></h3>
<p>The SWI-Prolog license allows it to be used in a wide variety of
environments, including closed-source commercial applications. In
practice, redistribution and embedding is allowed, as long as
<em>modifications</em> to the SWI-Prolog source are published following
the Free Software rules.
<p>The SWI-Prolog kernel and foreign libraries are licensed under the
<em>Lesser General Public License</em> (LGPL). The Prolog files are
licensed under the normal <em>General Public License</em> GPL with an
additional statement that allows for embedding in proprietary software:
<blockquote> As a special exception, if you link this library with other
files compiled with a Free Software compiler to produce an executable,
this library does not by itself cause the resulting executable to be
covered by the GNU General Public License. This exception does not,
however, invalidate any other reasons why the executable file might be
covered by the GNU General Public License.
</blockquote>
<p>This exception is a proven construct used for <em>libgcc</em>, the
GNU C-compiler runtime library.
<p>
<h3><a id="sec:4.3"><span class="sec-nr">4.3</span> <span class="sec-title">Supporting
SWI-Prolog</span></a></h3>
<p>There are several ways to support SWI-Prolog:
<p>
<ul class="latex">
<li>Extend the system with contributions.
<li>Improve the system by submitting bug reports and patches.
<li>Link to <a class="url" href="http://www.swi-prolog.org">http://www.swi-prolog.org</a>
and refer to SWI-Prolog in publications.
<li>For commercial users, it may be profitable to sponsor development
projects that make SWI-Prolog more useful for you and others. Example
projects from the part include adding the initial garbage collector,
unbounded integer support, SSL interface, (re-)introduction of the
stack-shifter, avoid C-recursion on Prolog data structures, the PlUnit
test environment and the PlDoc documentation environment.
<p>Sponsoring development has several benefits: (1) it solves your
bottlenecks, (2) others help debugging it, and (3) it strengthens
SWI-Prolog's position, which gives you better guarantees that the system
remains actively developed and makes it easier to find resources and
programmers.
</ul>
<h1><a id="document-index">Index</a></h1>
<dl>
<dt class="index-sep">?</dt>
<dt><a class="idx" href="#apropos/1">apropos/1</a></dt>
<dt><a class="idx" href="#consult/1">consult/1</a></dt>
<dt><a class="idx" href="#edit/0">edit/0</a></dt>
<dt><a class="idx" href="#edit/1">edit/1</a></dt>
<dd>
<a class="idx" href="#idx:edit1:3">1.4</a></dd>
<dt><a class="idx" href="#gtrace/0">gtrace/0</a></dt>
<dt><a class="idx" href="#help/1">help/1</a></dt>
<dd>
<a class="idx" href="#idx:help1:5">1.5</a></dd>
<dt><a class="idx" href="#ls/0">ls/0</a></dt>
<dt><a class="idx" href="#make/0">make/0</a></dt>
<dd>
<a class="idx" href="#idx:make0:1">1.3</a> <a class="idx" href="#idx:make0:2">1.4</a></dd>
<dt><a class="idx" href="#pwd/0">pwd/0</a></dt>
<dd>
<a class="idx" href="#idx:pwd0:4">1.5</a></dd>
<dt>qsave_program/2</dt>
<dd>
<a class="idx" href="#idx:qsaveprogram2:6">2.1</a></dd>
<dt><a class="idx" href="#trace/0">trace/0</a></dt>
<dd>
</dd>
</dl>
</body></html>
|