Qsave_program using foreign(save)

I’m using swi-prolog version 8.0.3 on Windows 10.

I used

qsave_program('my_app.exe', [autoload(false), stand_alone(true), toplevel(prolog), foreign(save)]) 

to generate my executable.

When I execute my application I receive the following message:

ERROR: c:/program files/swipl/library/http/readutil.pl: Initialization goal raised exception:
ERROR: No permission to modify static procedure 'read_util:read_line_to_codes/2'
ERROR: [14] assertz((read_line_to_codes(_1150,_1152):-pl_read_line_to_codes(_1156,_1158)))
ERROR: [13] read_util:link_foreign at c:/program files/swipl/library/readutil.pl:87
ERROR: [12] '$run_init_goal'(read_util:link_foreign) at c:/program files/swipl/boot/init.pl:618
ERROR: [11] catch(system: '$run_init_goal'(...),error(permission_error(modify,static_procedure,...),context(...,_1272)),system:'$initialization_error'(...,...,...)) at c:/program files/swipl/boot/init.pl:386
ERROR: [10] catch_with_backtrace(system:'$run_init_goal'(...),error(permission_error(modify,static_procedure,...),context(...,_1344)),system: '$initialization_error'(...,...,...)) at c:/program files/swipl/boot/init.pl:436
ERROR: c:/program files/swipl/library/socket.pl:182: Initialization goal raised exception:
ERROR: Não foi possível encontrar o módulo especificado.
ERROR: [17] throw(error(shared_object(open, 'Não foi possível encontar o módulo especificado.\r\n'),context(...,_2354)))
ERROR: [15] <meta call>
ERROR: [14] with_mutex('$foreign',load_foreign_library(foreign(socket),socket,Install_socket)) <foreign>
ERROR: [12] catch(system: '$run_init_goal'(...),_2478,system:'$initialization_error'(_2500,...,...)) at c:/program files/swipl/boot/init.pl:386
ERROR: [11] catch(system:'$initialization_error'(...,...,...)) at c:/program files/swipl/boot/init.pl:386
ERROR: [10] catch_with_backtrace(system:'$run_init_goal'(...),_2530,system:'$initialization_error'(_2552,...,...)) at c:/program files/swipl/boot/init.pl:436

This error is reported for uri.pl, sgml.pl, http_stream.pl and json.pl (all library reported by the command current_foreign_library).
I’m trying to generate a stand-alone application, why the source of the library (.pl) have been called?

PS. I’m using a Brazilian Portuguese Windows 10 installation.

1 Like

Hmm. Trying to save the most basic program with foreign extensions from Windows gives me this:

:- use_module(library(readutil)).

save :-
                  [ autoload(false),
$ swipl.exe test.pl
?- save.
ERROR: architecture_shlib(x64-win64) `foreign(readutil)' does not exist

That might be an 8.1.x issue. I’ll have a look later. The above works just fine on Linux.

After fixing finding the dlls the given program now works fine on the development version. You should be able to download that tomorrow from the daily builds. It the problem persists, please create a reproducible case.