SWI-Prolog/swipl

User init file does not appear to work in Windows 10, and "User init file..." menu selection crashes if file exists.

thezerobit opened this issue · 2 comments

I installed SWI-Prolog 8.4.3 64-bit in Windows 10 (for all users). If I create a user init file, it does not appear to load in either swipl-win or swipl. I created one with the contents "use_module(library(clpfd))." without the quotes of course. The clpfd module does not appear to be loaded when I start the program, however. Also, when I select Settings->"User init file..." from the menus again, the program dumps a bunch of red error text and then exits immediately. I have to do a very fast screen capture to see what the errors are.

If I delete the init.pl file (C:\Users\steve\AppData\Roaming\swi-prolog\init.pl) then the program no longer crashes when I select "User init file..." from the menu, it just asks me if I want to create one. I have attached a couple screen captures of the error messages.

Screenshot (6)
Screenshot (3)

I installed the 8.4.3 to a Windows Sandbox, ran swipl-win.exe and selected Settings/User init file ...
Then it asked do you want to create .... etc.
Then I wrote to init.pl use_module(library(clpfd)). saved that and exited swipl-win.
Restarted swipl-win and selected Settings/User init file ... Now I get the errors and swipl-win exits.

If I write :- use_module(library(clpfd)). to init.pl I get an error free swipl-win and I can run clpfd

?- current_module(clpfd).
true.

?- X #= 1+2.
X = 3

So, what is the error? You load libraries using :- use_module(...).. Without it defined use_module/1 and things go wrong. Once you have used use_module/1, an attempt to (re)define it will cause an error. init.pl is loaded first though, so you can still (re)define it. Only ISO standard predicates may never be redefined. You can use ?- check. to check for redefined predicates and see whether that is ok.