# Ann: SWI-Prolog 9.3.16

**URL:** <https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645>\
**Category:** Releases\
**Created:** [December 2, 2024, 3:21pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645 "2024-12-02T15:21:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [December 2, 2024, 3:21pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/1 "2024-12-02T15:21:31Z")

</div>

Dear SWI-Prolog user,

SWI-Prolog 9.3.16 is ready for download. This version fixes some  
important bugs and provides one new library. Highlights:

- WASM `for(v of Query)` and variants lost the last solution due to  
a bug in the JavaScript _iterator_ implementation.
- Fixed phrase\_from\_file/2 for UTF-16 files containing  
_surrogate pairs_ on Windows.
- Improved support for ==\> SSU DCG rules: mark predicate as  
`non_terminal` and provide basic support for the GUI debugger.
- An experimental library `exceptions` allows for defining exception  
types and catching based on type rather than unification. See  
catch/4 in this library. Comments welcome!
- Changed search for the Prolog home to consider the _ABI version_  
info and provide better feedback if the search fails. This should  
notably simplify embedding SWI-Prolog if you have multiple SWI-Prolog  
installations on your system.
- Avoid Emscripten (WASM) deprecated functions.
- Fix test failures for prolog\_in\_java tests when the build system  
has multiple copies of `junit[4].jar` in places we look for it.

Enjoy — Jan

P.s. We are approaching 1,000 ⭐s on Github. Starring the repo is  
simplest thing you can do to help the system. We also got  
new donations. Thanks!

# SWI-Prolog Changelog since version 9.3.15

- ENHANCED: gui tracer support for `Head ==> Body` rules.

- ENHANCED: Set `non_terminal` property for clauses for `Head ==> Body`

- WASM: Include ABI file to make the home search work.

- FIXED: New home search to actually try the compiled in value.

- ENHANCED: Verify sanity of the Prolog home directory This patch  
validates that the home directory contains a file ABI holding the  
ABI information and compares this. On failure, it reports a detailed  
report on why Prolog could not find its home directory.

- FIXED: explain/1 to report the same predicate multiple times.  
This happens if the predicate is imported into multiple modules.

- ADDED: library(exceptions) This library provides catch/4 and error/2  
to define error types and catch based on types rather than unification.  
Experimental.

- PORT: read\_pending\_input/3 and friends: make 16 bit encodings work  
on Windows.

- FIXED: Pass command line arguments in class Prolog.

- DOC: gcd/2 and lcm/2 are not operators.

- ADDED: Prolog flag `unknown_option` with values {ignore,warning,error}.  
As a result of PIP-105. May change, but unlikely as their was clear  
agreement.

- FIXED: Use of undefined options in the toplevel. This makes the  
toplevel unusable if the Prolog flag `iso` is set to `true`.

- PORT: WASM: Get rid of deprecated allocate, ALLOC\_NORMAL and  
ALLOC\_STACK

- FIXED: WASM: Query.next() to set `done` to `true` on last answer.  
This must be `false` when used as iterator.

- ENHANCED: Allow suppressing autoload warnings.

- TEST: Move test\_rwlocks.pl from `library` to `thread` test dir.  
This test should not run in the single threaded version.

- FIXED: WASM: for(x of prolog.query(…)) lost last answer

## Package http

- DOC: Fixed example code for apropos with HTML output.

## Package jpl

- TEST: #104 prolog\_in\_java test fails if multiple copies of junit\*.jar  
are found. Now first search for junit_4_.jar. On success, use first,  
else search for junit.jar. On success, use first.

- TEST: Cache JUNIT\_JAR in CMake. This provides better cmake performance  
and easier inspecting the configuration result.

## Package swipy

- BUILD: Honour environment variable `SWIPL` for `pip install .`

- DOC: Document creating the Windows binary wheel in `scripts/README.md`

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [December 3, 2024, 8:55am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/2 "2024-12-03T08:55:43Z")

</div>

With `CC="gcc (or clang) -std=gnu23" cmake ..`, I get a compiler error.

```prolog
.../src/pl-prof.c:289:23: error: incompatible function pointer types passing 'void (int)' to parameter of type 'handler_t' (aka 'int (*)(int)') [-Wincompatible-function-pointer-types]
  289 | set_sighandler(sig, sig_profile);
      | ^ ~~~~~~~~~~.../src/pl-setup.h:62:45: note: passing argument to parameter 'func' here
   62 | handler_t set_sighandler(int sig, handler_t func);

```

I tried to fix it with `CC="gcc -std=gnu23" cmake -DCMAKE_C_STANDARD=23 -DCMAKE_C_EXTENSIONS=ON ..`, but that doesn’t help. Am I missing something?

PS. The problem is not specific to 9.3.16, was just recently reported by the R people.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [December 3, 2024, 10:03am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/3 "2024-12-03T10:03:57Z")

</div>

I see. The cmake test whether the return type of a signal handler is `void` or `int` was broken for c23. Fixed.

I don’t know whether this test still makes sense as `void` is the standard return type for signal handlers for a long time. Similar considerations apply to quite a few tests. They are there because at some point in the past they were needed. Fortunately standardization has progressed 🙂

Removing simplifies the code base, but at the risk of making mistakes and discontinued support for old platforms ☹

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [December 6, 2024, 7:31am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/4 "2024-12-06T07:31:02Z")

</div>

Thank you, problem solved

[https://cran.r-project.org/web/checks/check\_results\_rswipl.html](https://cran.r-project.org/web/checks/check_results_rswipl.html)

---

<div class="post-metadata">

**Author:** ![z5h](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/z5h/32/5445_2.png) [@z5h](https://swi-prolog.discourse.group/u/z5h)\
**Post date:** [December 7, 2024, 9:31pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/5 "2024-12-07T21:31:14Z")

</div>

Just saw some errors in my console that make is seem like something has been compiled to expect swipl is running in your personal “jan” directory:

```prolog
Warning: [Thread pce] The predicates below are not defined. If these are defined
Warning: [Thread pce] at runtime using assert/1, use :- dynamic Name/Arity.
Warning: [Thread pce] 
Warning: [Thread pce] '$bags':'$call_cleanup'/0, which is referenced by
Warning: [Thread pce] /Users/jan/src/swipl-devel/build.macosx-fat/home/boot/bags.pl:104: 1-st clause of '$bags':cleanup_bag/2
Warning: [Thread pce] '$messages':win_get_user_preferred_ui_languages/2, which is referenced by
Warning: [Thread pce] /Users/jan/src/swipl-devel/build.macosx-fat/home/boot/messages.pl:1947: 1-st clause of '$messages':os_user_lang/1
Warning: [Thread pce] '$toplevel':win_registry_get_value/3, which is referenced by
Warning: [Thread pce] /Users/jan/src/swipl-devel/build.macosx-fat/home/boot/toplevel.pl:529: 1-st clause of '$toplevel':'$set_prolog_file_extension'/0
Warning: [Thread pce] qsave:qsave_toplevel/0, which is referenced by
Warning: [Thread pce] /Users/jan/src/swipl-devel/build.macosx-fat/home/boot/toplevel.pl:914: 1-st clause of '$toplevel':'$compile_'/0

```

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [December 8, 2024, 9:47am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/6 "2024-12-08T09:47:18Z")

</div>

Hmm. The paths from which the compiled files are loaded still seem to be there. That is a little odd as I think they should normally be updated at load time to the actual sources. It is in any case harmless.

How did you get these messages though?

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [December 8, 2024, 9:57am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/7 "2024-12-08T09:57:51Z")

</div>

I get the same if I just start swipl and run

```
?- make.

```

This happens only on Mac OS, after building from source

---

<div class="post-metadata">

**Author:** ![CapelliC](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/capellic/32/17_2.png) [@CapelliC](https://swi-prolog.discourse.group/u/CapelliC)\
**Post date:** [December 8, 2024, 10:52am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/8 "2024-12-08T10:52:45Z")

</div>

Just downloaded 9.3.16 for Windows. The problem shows up here, as well:

```prolog
?- make.
Warning: The predicates below are not defined. If these are defined
Warning: at runtime using assert/1, use :- dynamic Name/Arity.
Warning: 
Warning: '$bags':'$call_cleanup'/0, which is referenced by
Warning: z:/home/swipl/src/swipl-devel/build.win64/home/boot/bags.pl:104: 1-st clause of '$bags':cleanup_bag/2
Warning: qsave:qsave_toplevel/0, which is referenced by
Warning: z:/home/swipl/src/swipl-devel/build.win64/home/boot/toplevel.pl:914: 1-st clause of '$toplevel':'$compile_'/0
true.

```

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [December 8, 2024, 11:02am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/9 "2024-12-08T11:02:18Z")

</div>

> [@Boris](#):
>
> This happens only on Mac OS, after building from source

> [@CapelliC](#):
>
> Just downloaded 9.3.16 for Windows. The problem shows up here, as well:

I can confirm both. Odd. Will check.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [December 8, 2024, 3:30pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-16/8645/10 "2024-12-08T15:30:22Z")

</div>

Ok. Fixed. Turns out to be a build ordering issue related to the new ABI compatibility check.
