Upgrading from version 7 to 8 error while running consult/1 predicate

Hello swi-prolog users,

I have developed a swi-prolog program to help me in my daily work. It was developed through several years so it has very large files of code.
This software seemed to be fine until I have tried to run it using swi-prolog 8.2.4.

Now when I run consult/1 predicate I receive error messages which I report below. However this do not happen before, while using swi-prolog version 7.

Can anybody give me some help about this? Thank you in advance,


ERROR: c:/users/windows/documents/prolog/common_phd/common0_main_structure.pl:11:
ERROR:    catch/3: Unknown procedure: module/2
ERROR:      However, there are definitions for:
ERROR:            module/1
Warning: c:/users/windows/documents/prolog/common_phd/common0_main_structure.pl:11:
Warning:    Goal (directive) failed: user:module(structure_main,[common_Editor/0,cE/0,abrir_Structure/0,dialog_salvar_sair_Structure/1,reDraw_structure_building/1,dia...

Looks like there is something in the file before the module header? AFAIK the only changes in this area are stricter checking, i.e., older versions handling incorrect declarations silently in some wrong way. If this doesn’t help, please include the start of the file.

Since the problem remained I include the start of the file,


:- module(common_MaterialsDB,
[ mzCAD_data_base/9, rctCAD_data_base/4,
exp_toc_mzCAD/1, exp_toc_rctCAD/1,
mzCAD_materials_DataBase/0, rctCAD_materials_DataBase/0,
dialog_Material_Regular/1, create_Material_Regular/10,
dialog_Material_Glass/1, dialog_Material_Air/1,
converter_Write2File_BaseDados/2, abreviatura_para_Texto/2,
materials_Radiance/0 ]).

:- require([defs/2, change_icon_dialog_2/2,
ver_RctCAD_Current_Object/1, ver_ePLus_Current_Object/1,
dialog_Radiance_Material/3, dialog_Radiance_Material_Glass/3,
dialog_Radiance_Texture/3 ]).
material_construcao(nome), object
:- use_module(library(pce_toc)).

Jan Wielemaker via SWI-Prolog <swiprolog@discoursemail.com> escreveu no dia quarta, 28/04/2021 à(s) 09:38:

That looks fine, unless there is something hidden at the start of the file. Assuming that is not the case the next suspicious cause are term_expansion/2 rules that expand the module header by adding something before it. Does the problem go away if you only load this file? If so I’d search for term_expansion that might do strange things and otherwise bisect the problem by removing and re-adding parts of the rest of the program. Seems a weird issue …

Perhaps there are things that might cause problems, For instance

I have a statement like the following one which is below the code that I have just sent to you

:- pce_image_directory(‘c:/Programas/swipl/xpce/bitmaps/48x48/’).

Thank you so much

Jan Wielemaker via SWI-Prolog <swiprolog@discoursemail.com> escreveu no dia quarta, 28/04/2021 à(s) 12:22:

This as such still works as it is used all over the place in the xpce libraries. We really need a (preferably) small complete piece of code and what to do. As is, it is magic and just about anything may cause this. Could you (for example) load this file using include/1?