# PlDoc

**URL:** https://swi-prolog.discourse.group/c/help/pldoc/24.md

[Latest](https://swi-prolog.discourse.group/latest.md) · [Categories](https://swi-prolog.discourse.group/categories.md) · [Tags](https://swi-prolog.discourse.group/tags.md)

---

## [About the PlDoc category](https://swi-prolog.discourse.group/t/about-the-pldoc-category/2635)

<div class="topic-metadata">

**Author:** [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Replies:** 0

</div>

When you need help with PlDoc (SWI-Prolog documentation), e.g. writing declaration headers, creating output, etc.

---

## [How to generate full doc files of a project?](https://swi-prolog.discourse.group/t/how-to-generate-full-doc-files-of-a-project/9831)

<div class="topic-metadata">

**Author:** [@andrii](https://swi-prolog.discourse.group/u/andrii)\
**Replies:** 1\
**Last updated:** [September 21, 2026, 6:36pm UTC](https://swi-prolog.discourse.group/t/how-to-generate-full-doc-files-of-a-project/9831 "2026-09-21T18:36:35Z")

</div>

I tried using doc\_save(., \[\]), but it does not generate separate pages for predicates, while still generating the respective hrefs in index.html. Suppose I have a prolog file test.pl I want to have a documentation for, …

---

## [How to use swipl within my C++ program?](https://swi-prolog.discourse.group/t/how-to-use-swipl-within-my-c-program/9620)

<div class="topic-metadata">

**Author:** [@Raphy](https://swi-prolog.discourse.group/u/Raphy)\
**Replies:** 22\
**Last updated:** [May 20, 2026, 10:20pm UTC](https://swi-prolog.discourse.group/t/how-to-use-swipl-within-my-c-program/9620 "2026-05-20T22:20:36Z")

</div>

I compiled and built swipl-devel in this way: raphy@raphy:~$ git clone --recursive https://github.com/SWI-Prolog/swipl-devel.git raphy@raphy:~/swipl-devel$ cmake -DCMAKE\_INSTALL\_PREFIX=/home/raphy/MyPrj/src/swipl-deve…

---

## [Can't create a file](https://swi-prolog.discourse.group/t/cant-create-a-file/9531)

<div class="topic-metadata">

**Author:** [@Glad33k](https://swi-prolog.discourse.group/u/Glad33k)\
**Replies:** 3\
**Last updated:** [February 28, 2026, 7:12am UTC](https://swi-prolog.discourse.group/t/cant-create-a-file/9531 "2026-02-28T07:12:19Z")

</div>

Hi, it’s my first day with prolog because im studying IT, i have to create a file in prolog but on my computer i can’t. Only i get that message, and when i click to create file it automatically crash.

---

## [XPCE, Boîte de Dialog](https://swi-prolog.discourse.group/t/xpce-boite-de-dialog/9363)

<div class="topic-metadata">

**Author:** [@miguel](https://swi-prolog.discourse.group/u/miguel)\
**Replies:** 4\
**Last updated:** [November 8, 2025, 4:17pm UTC](https://swi-prolog.discourse.group/t/xpce-boite-de-dialog/9363 "2025-11-08T16:17:57Z")

</div>

Bonjour, peut-être ai-je négligé une option de configuration, mais je ne parviens pas à obtenir la boîte de dialog telle que présentée par le manuel de XPCE (commande manpce. sous le prompt Prolog ou en cliquant su…

---

## [Random number generation, seeds, and GMP](https://swi-prolog.discourse.group/t/random-number-generation-seeds-and-gmp/9317)

<div class="topic-metadata">

**Author:** [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Replies:** 3\
**Last updated:** [September 25, 2025, 10:49am UTC](https://swi-prolog.discourse.group/t/random-number-generation-seeds-and-gmp/9317 "2025-09-25T10:49:22Z")

</div>

Is the claim in the documentation to getrand/1 and setrand/1 still correct? It says, Errors - existence\_error(random\_state, \_) is raised if the underlying infrastructure cannot fetch the random state. This is currentl…

---

## [Is the documentation of library(heaps) confusing?](https://swi-prolog.discourse.group/t/is-the-documentation-of-library-heaps-confusing/9259)

<div class="topic-metadata">

**Author:** [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Replies:** 5\
**Last updated:** [September 9, 2025, 3:55pm UTC](https://swi-prolog.discourse.group/t/is-the-documentation-of-library-heaps-confusing/9259 "2025-09-09T15:55:08Z")

</div>

Maybe it is just me. I think the underlying reason is the generous use of the forward slash in the text. For example, we find the following pairs (with a bit of context, because I am not even sure how should this parse, …

---

## [Janus: py\_call(1 + 2, Sum)](https://swi-prolog.discourse.group/t/janus-py-call-1-2-sum/8876)

<div class="topic-metadata">

**Author:** [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Replies:** 8\
**Last updated:** [March 13, 2025, 10:04am UTC](https://swi-prolog.discourse.group/t/janus-py-call-1-2-sum/8876 "2025-03-13T10:04:13Z")

</div>

How do I call a python primitive like plus? 7 ?- use\_module(library(janus)). true. 8 ?- py\_call(print("Hello World!\\n")). Hello World! true. 9 ?- py\_call(sys:getsizeof(\[1,2,3\]), Size). Size = 80. 10 ?- py\_call(1 + 2…

---

## [Serializing terms with the foreign language interface](https://swi-prolog.discourse.group/t/serializing-terms-with-the-foreign-language-interface/8751)

<div class="topic-metadata">

**Author:** [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Replies:** 1\
**Last updated:** [January 24, 2025, 12:56pm UTC](https://swi-prolog.discourse.group/t/serializing-terms-with-the-foreign-language-interface/8751 "2025-01-24T12:56:40Z")

</div>

In the Foreign Include File section, there is subsection 12.4.9, Serializing and deserializing Prolog terms. If I am reading this correctly, it only discusses de-serialization through PL\_put\_term\_from\_chars(). Is the se…

---

## [Misleading documentation of sort/4](https://swi-prolog.discourse.group/t/misleading-documentation-of-sort-4/8716)

<div class="topic-metadata">

**Author:** [@mike.elston](https://swi-prolog.discourse.group/u/mike.elston)\
**Replies:** 2\
**Last updated:** [January 5, 2025, 11:12am UTC](https://swi-prolog.discourse.group/t/misleading-documentation-of-sort-4/8716 "2025-01-05T11:12:46Z")

</div>

Hi The documention of sort/4 sort/4 says: The following example sorts a list of rows, for example resulting from csv\_read\_file/2) ascending on the 3th column and descending on the 4th column: sort(4, @\>=, Rows0, Rows…

---

## [PlDoc and foreign code](https://swi-prolog.discourse.group/t/pldoc-and-foreign-code/8577)

<div class="topic-metadata">

**Author:** [@pizzapal](https://swi-prolog.discourse.group/u/pizzapal)\
**Replies:** 2\
**Last updated:** [November 3, 2024, 5:23pm UTC](https://swi-prolog.discourse.group/t/pldoc-and-foreign-code/8577 "2024-11-03T17:23:51Z")

</div>

Can I get PlDoc to slurp up predicate documentation comments for foreign predicates (i.e., written in C or C++ and registered using some variety of PL\_register\_\*)? I have a definition this, registered using the SWI-cpp2…

---

## [How to Retrieve All Outputs from SWISH Prolog?](https://swi-prolog.discourse.group/t/how-to-retrieve-all-outputs-from-swish-prolog/7703)

<div class="topic-metadata">

**Author:** [@pianonyy](https://swi-prolog.discourse.group/u/pianonyy)\
**Replies:** 2\
**Last updated:** [August 20, 2024, 1:44pm UTC](https://swi-prolog.discourse.group/t/how-to-retrieve-all-outputs-from-swish-prolog/7703 "2024-08-20T13:44:52Z")

</div>

How to Retrieve All Outputs and Understand Variable Creation as we can do it in web version of swi prolog?

---

## [Http\_open throwing an error in version 9.3.6](https://swi-prolog.discourse.group/t/http-open-throwing-an-error-in-version-9-3-6/7563)

<div class="topic-metadata">

**Author:** [@joeblog](https://swi-prolog.discourse.group/u/joeblog)\
**Replies:** 4\
**Last updated:** [July 8, 2024, 8:35am UTC](https://swi-prolog.discourse.group/t/http-open-throwing-an-error-in-version-9-3-6/7563 "2024-07-08T08:35:00Z")

</div>

I just ran a script that used to work (I posted the code a while back at Initial attempt at a kif to Prolog translator), but running the same example now produces: ERROR: /usr/lib/swipl/library/http/http\_open.pl:67: ERR…

---

## [Exported procedure socket:tcp\_connect/2 is not defined](https://swi-prolog.discourse.group/t/exported-procedure-socket-tcp-connect-2-is-not-defined/7546)

<div class="topic-metadata">

**Author:** [@BenEngbers](https://swi-prolog.discourse.group/u/BenEngbers)\
**Replies:** 8\
**Last updated:** [June 30, 2024, 1:36am UTC](https://swi-prolog.discourse.group/t/exported-procedure-socket-tcp-connect-2-is-not-defined/7546 "2024-06-30T01:36:57Z")

</div>

Hi, Past year I had no time to play with Prolog but today I finally found time to get back to work on a project I had started earlier. I was still using a Swipl version that was over a year old. Updating Swipl did not …

---

## [Confusion with C++ interface and Prolog lists](https://swi-prolog.discourse.group/t/confusion-with-c-interface-and-prolog-lists/6355)

<div class="topic-metadata">

**Author:** [@salamander](https://swi-prolog.discourse.group/u/salamander)\
**Replies:** 38\
**Last updated:** [June 17, 2024, 9:13pm UTC](https://swi-prolog.discourse.group/t/confusion-with-c-interface-and-prolog-lists/6355 "2024-06-17T21:13:52Z")

</div>

The examples do a good job of explaining PREDICATE and unifying atoms and integers within those predicates. I am struggling to understand how to unify new Prolog lists within this context and there are not a lot of exam…

---

## [Unit test fails from R](https://swi-prolog.discourse.group/t/unit-test-fails-from-r/7448)

<div class="topic-metadata">

**Author:** [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Replies:** 2\
**Last updated:** [May 24, 2024, 8:28pm UTC](https://swi-prolog.discourse.group/t/unit-test-fails-from-r/7448 "2024-05-24T20:28:20Z")

</div>

I copied this snipped from the unit tests: test\_interrupt(Goal) :- thread\_self(Me), thread\_create(run(Me, Goal), Id, \[\]), thread\_get\_message(running), sleep(0.1), thread\_signal(Id…

---

## [Problem with Calling Prolog from Python](https://swi-prolog.discourse.group/t/problem-with-calling-prolog-from-python/7350)

<div class="topic-metadata">

**Author:** [@martinkleinaustria](https://swi-prolog.discourse.group/u/martinkleinaustria)\
**Replies:** 10\
**Last updated:** [April 7, 2024, 6:57pm UTC](https://swi-prolog.discourse.group/t/problem-with-calling-prolog-from-python/7350 "2024-04-07T18:57:48Z")

</div>

I successfully did some Prolog from Python examples but failed on this one: import janus\_swi as janus janus.consult("get", """ :- use\_module(library(lists)). frame(name(bird), isa(animal), \[travel(flies), feathers\], \[ …

---

## [Pldoc predicate ordering](https://swi-prolog.discourse.group/t/pldoc-predicate-ordering/7264)

<div class="topic-metadata">

**Author:** [@ridgeworks](https://swi-prolog.discourse.group/u/ridgeworks)\
**Replies:** 5\
**Last updated:** [February 28, 2024, 6:30pm UTC](https://swi-prolog.discourse.group/t/pldoc-predicate-ordering/7264 "2024-02-28T18:30:12Z")

</div>

I’m in the process of adding pldoc to a module and I’m struggling with the order in which the exported predicates appear in the doc. Basic scenario: I have a module with fairly long export list. About half the exported p…

---

## [Swipl-win.exe crash... hint about debugging](https://swi-prolog.discourse.group/t/swipl-win-exe-crash-hint-about-debugging/7096)

<div class="topic-metadata">

**Author:** [@CapelliC](https://swi-prolog.discourse.group/u/CapelliC)\
**Replies:** 7\
**Last updated:** [February 9, 2024, 12:43pm UTC](https://swi-prolog.discourse.group/t/swipl-win-exe-crash-hint-about-debugging/7096 "2024-02-09T12:43:23Z")

</div>

I’m trying to develop a swipl-win (Qt 6.6) interface for OGDF, but I’ve got the following SIGSEGV GDB report in QtCreator:1 strlen 0x7ffb3ec92071 2 libswipl!PL\_new\_ato…

---

## [Module unload/delete](https://swi-prolog.discourse.group/t/module-unload-delete/7222)

<div class="topic-metadata">

**Author:** [@nobleg](https://swi-prolog.discourse.group/u/nobleg)\
**Replies:** 2\
**Last updated:** [February 5, 2024, 8:30pm UTC](https://swi-prolog.discourse.group/t/module-unload-delete/7222 "2024-02-05T20:30:24Z")

</div>

I am sure i have missed the obvious,… but if i have loaded a large module, but then dont need it anymore, how do I unload / delete the module so resources can be returned to the core ! … Ready to be embarrassed

---

## [PlDoc with reexport](https://swi-prolog.discourse.group/t/pldoc-with-reexport/7039)

<div class="topic-metadata">

**Author:** [@friguzzi](https://swi-prolog.discourse.group/u/friguzzi)\
**Replies:** 6\
**Last updated:** [December 11, 2023, 10:35am UTC](https://swi-prolog.discourse.group/t/pldoc-with-reexport/7039 "2023-12-11T10:35:49Z")

</div>

Hi all, I noticed a glitch of PlDoc with modules that reexports the predicates of another module with the reexport directive. When showing the PlDoc page of the original module, the reexported predicates, even if corre…

---

## [How to use "gtrace" in VScode?](https://swi-prolog.discourse.group/t/how-to-use-gtrace-in-vscode/7033)

<div class="topic-metadata">

**Author:** [@EySword](https://swi-prolog.discourse.group/u/EySword)\
**Replies:** 8\
**Last updated:** [December 6, 2023, 3:22pm UTC](https://swi-prolog.discourse.group/t/how-to-use-gtrace-in-vscode/7033 "2023-12-06T15:22:35Z")

</div>

I have \[SWI-Prolog 9.0.4\] installed. When I open swipl in vscode and type “gtrace.” in terminal, it shows: ?- gtrace. Correct to: "trace"? no ERROR: Unknown procedure: gtrace/0 ERROR: However, there are definitions f…

---

## [Linux 22.04, wanting graphical user interface](https://swi-prolog.discourse.group/t/linux-22-04-wanting-graphical-user-interface/6992)

<div class="topic-metadata">

**Author:** [@nobleg](https://swi-prolog.discourse.group/u/nobleg)\
**Replies:** 4\
**Last updated:** [November 23, 2023, 1:57pm UTC](https://swi-prolog.discourse.group/t/linux-22-04-wanting-graphical-user-interface/6992 "2023-11-23T13:57:54Z")

</div>

on ubuntu 2204 hi im , prolog 9.1.18 wanted deve version so used snap install. start from commandline as prolog other names dont work swi-prolog etc pce does not work Also use\_library( pce ) which loads but …

---

## [How to preserve JS expressions unquoted in arguments](https://swi-prolog.discourse.group/t/how-to-preserve-js-expressions-unquoted-in-arguments/6853)

<div class="topic-metadata">

**Author:** [@firefrorefiddle](https://swi-prolog.discourse.group/u/firefrorefiddle)\
**Replies:** 2\
**Last updated:** [September 19, 2023, 1:32pm UTC](https://swi-prolog.discourse.group/t/how-to-preserve-js-expressions-unquoted-in-arguments/6853 "2023-09-19T13:32:49Z")

</div>

I can’t figure out how to preserve a JS expression in an HTML argument in html\_write. Here is an example from the HTMX book (Extending HTML As Hypermedia). I want to generate this expression in HTML: \<button hx-get="/…

---

## [PceEmacs says predicate is unreferenced](https://swi-prolog.discourse.group/t/pceemacs-says-predicate-is-unreferenced/6722)

<div class="topic-metadata">

**Author:** [@z5h](https://swi-prolog.discourse.group/u/z5h)\
**Replies:** 1\
**Last updated:** [July 20, 2023, 3:43pm UTC](https://swi-prolog.discourse.group/t/pceemacs-says-predicate-is-unreferenced/6722 "2023-07-20T15:43:09Z")

</div>

In short: Is there a way of convincing PceEmacs that a predicate is used, when PceEmacs has decided otherwise? More detail: PceEmacs flags unused predicates, and is pretty good at detecting partial application of pred…

---

## [Trying to use SwiPlCs in C# app](https://swi-prolog.discourse.group/t/trying-to-use-swiplcs-in-c-app/6712)

<div class="topic-metadata">

**Author:** [@Relvox](https://swi-prolog.discourse.group/u/Relvox)\
**Replies:** 0\
**Last updated:** [July 16, 2023, 9:25pm UTC](https://swi-prolog.discourse.group/t/trying-to-use-swiplcs-in-c-app/6712 "2023-07-16T21:25:25Z")

</div>

Hello there! I’m trying to include SwiPlCs in my net7.0 project. When I put this in my .csproj \<Reference Include="SwiPlCs"\> \<HintPath\>lib\\SwiPlCs.dll\</HintPath\> \</Reference\> I get: Unhandled exception. System.A…

---

## [CLP over Finite Set](https://swi-prolog.discourse.group/t/clp-over-finite-set/6610)

<div class="topic-metadata">

**Author:** [@z5h](https://swi-prolog.discourse.group/u/z5h)\
**Replies:** 3\
**Last updated:** [June 5, 2023, 2:49pm UTC](https://swi-prolog.discourse.group/t/clp-over-finite-set/6610 "2023-06-05T14:49:32Z")

</div>

I’m analyzing games. Imagine applying Sudoku-like constraints to a board of (finitely many) arbitrary non-integer terms (house(green), soldier, cow, etc). For example, a soldier cannot be beside a house, there is one cow…

---

## [Can't build wasm](https://swi-prolog.discourse.group/t/cant-build-wasm/6583)

<div class="topic-metadata">

**Author:** [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Replies:** 8\
**Last updated:** [June 3, 2023, 12:11pm UTC](https://swi-prolog.discourse.group/t/cant-build-wasm/6583 "2023-06-03T12:11:16Z")

</div>

I tried following the instructions at SWI-Prolog in the browser using WASM , and I’ve made a few edits to the instructions where I had problems; but now I’m stuck. The error message is a bit suspicious because it points…

---

## [Water Jug problem using state space and dfs in prolog](https://swi-prolog.discourse.group/t/water-jug-problem-using-state-space-and-dfs-in-prolog/6415)

<div class="topic-metadata">

**Author:** [@nino144](https://swi-prolog.discourse.group/u/nino144)\
**Replies:** 2\
**Last updated:** [March 29, 2023, 10:17am UTC](https://swi-prolog.discourse.group/t/water-jug-problem-using-state-space-and-dfs-in-prolog/6415 "2023-03-29T10:17:18Z")

</div>

I’m solving the water jug problem using state space and dfs,jug 1 have capacity of 4,jug 2 have capacity of 3,show the path to make jug 2 have 2 in it % Water Jug problem using DFS in Prolog % Define the initial state …

---

## [Binary with\_output\_to/2](https://swi-prolog.discourse.group/t/binary-with-output-to-2/6337)

<div class="topic-metadata">

**Author:** [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Replies:** 2\
**Last updated:** [March 7, 2023, 5:10pm UTC](https://swi-prolog.discourse.group/t/binary-with-output-to-2/6337 "2023-03-07T17:10:56Z")

</div>

For some unit tests, I want to write to a binary list of codes. But it seems that with\_output\_to(codes(Stream), ...) does some kind of encoding (UTF8, I suppose). I can make my unit test with tmp\_file\_stream/3 and the o…

[Next page](https://swi-prolog.discourse.group/c/help/pldoc/24.md?page=1)
