# prolog\_mode.pl:1627:Unhandled exception: -- only on Windows (not ubuntu)

**URL:** <https://swi-prolog.discourse.group/t/prolog-mode-plunhandled-exception-only-on-windows-not-ubuntu/237>\
**Category:** Help!\
**Created:** [February 10, 2019, 6:57am UTC](https://swi-prolog.discourse.group/t/prolog-mode-plunhandled-exception-only-on-windows-not-ubuntu/237 "2019-02-10T06:57:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![grossdan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/grossdan/32/23_2.png) [@grossdan](https://swi-prolog.discourse.group/u/grossdan)\
**Post date:** [February 10, 2019, 6:57am UTC](https://swi-prolog.discourse.group/t/prolog-mode-plunhandled-exception-only-on-windows-not-ubuntu/237/1 "2019-02-10T06:57:04Z")

</div>

Hi,

Its the first time I seem to get an error related to the prolog / PDT / swipl-win.exe (one of them).

I have some short code that looks up a table for a predicate name and first argument (that was previously asserted), and does a call/2 call.

When i try to trace this, i get a small popup window in Eclipse / PDT environment with an infiinte loop – with one of the messages show in the subject line.

This runs for a little while until prolog traps.

This only happens on widnows – the same code runs on ubuntu ( on my notebook i work in ubuntu and on the desktop in windows 7, prolog 8.0.0.0 64 bit)

any thoughts would be much appreciated,

thank you,

Dan

---

<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:** [February 10, 2019, 8:55am UTC](https://swi-prolog.discourse.group/t/prolog-mode-plunhandled-exception-only-on-windows-not-ubuntu/237/2 "2019-02-10T08:55:19Z")

</div>

Please add code and instructions to reproduce. In general the Windows version is less robust than the Linux version though.

---

<div class="post-metadata">

**Author:** ![grossdan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/grossdan/32/23_2.png) [@grossdan](https://swi-prolog.discourse.group/u/grossdan)\
**Post date:** [February 10, 2019, 10:12am UTC](https://swi-prolog.discourse.group/t/prolog-mode-plunhandled-exception-only-on-windows-not-ubuntu/237/3 "2019-02-10T10:12:15Z")

</div>

Hi Jan,

Ok. I managed to reconstruct the problem … and fix it

Apparently I declared a predicate a dynamic but forgot to add the :-

Oddly, the fact asserted correctly anyway – but eventually lead to the problem.

Here is code that causes the problem:

```auto
% note the missing :-
dynamic call_db/2.

pred1(Arg) :-
	writeln(Arg).

assert_call :-
	assert(the_call(pred1, arg1)).
	
make_call :-
	the_call(P, Arg),
	call(P, Arg).

```

Now, when doing the following:

assert\_call.

trace, make\_call. % \<- this causes the popup …

Dan

---

<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:** [February 10, 2019, 11:45am UTC](https://swi-prolog.discourse.group/t/prolog-mode-plunhandled-exception-only-on-windows-not-ubuntu/237/4 "2019-02-10T11:45:39Z")

</div>

The main issue seems to be the definition of dynamic/1. Pushed a fix to prevent that, Users may redefine system predicates, but not the ISO ones. dynamic was not flagged as ISO though. By running check/0 you do get some info:

```auto
% Checking undefined predicates ...
Warning: The predicates below are not defined. If these are defined
Warning: at runtime using assert/1, use :- dynamic Name/Arity.
Warning: 
Warning: the_call/2, which is referenced by
Warning: /home/jan/src/swipl-devel/linux/d.pl:11:0: 1-st clause of make_call/0
% Checking trivial failures ...
% Checking redefined system and global predicates ...
% dynamic/1 System predicate redefined globally
% Checking predicates with declarations but without clauses ...
% Checking predicates that need autoloading ...

```

i.e., it tells you the predicate is not dynamic and that dynamic/1 is redefined.
