prolog_mode.pl:1627:Unhandled exception: -- only on Windows (not ubuntu)

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

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

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:

% 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

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:

% 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.