问题
I am trying to create a saved state from toplevel in Windows, but I keep getting this error:
1 ?- qsave_program('U:/boo64.prc').
% library(broadcast) compiled into broadcast 0.00 sec, 7,504 bytes
% library(debug) compiled into prolog_debug 0.00 sec, 21,544 bytes
% library(option) compiled into swi_option 0.00 sec, 14,416 bytes
% library(arithmetic) compiled into arithmetic 0.00 sec, 33,872 bytes
% library(settings) compiled into settings 0.00 sec, 120,152 bytes
% c:/program files/swi-prolog/library/listing compiled into prolog_listing 0.00 sec, 180,936 bytes
% library(occurs) compiled into occurs 0.00 sec, 5,144 bytes
% library(prolog_clause) compiled into prolog_clause 0.00 sec, 61,544 bytes
% c:/program files/swi-prolog/library/prolog_stack compiled into prolog_stack 0.00 sec, 77,320 bytes
ERROR: '$mark_executable'/1: file `U:/boo64.prc' does not exist (No such file or directory)
2 ?-
I thought this should do it. Why does it even try to call 'mark_executable'? All I want is a ressource file that I can load from my embedded C/C++ application.
Anyone can help?
回答1:
The SWI-Prolog documentation for qsave_program
is terse and difficult to follow, but
start here. The last two sections, Creating a saved-state and Compilation using the -c command-line option will at least give you an example to try.
I think the problem here is that using the 1-argument version of qsave_program
forces the program state to be save not just as a resource but as a resource appended to the end of a machine dependent executable, the Prolog emulator. Such a file on Windows needs the .exe
extension, but you are trying to force a .prc
extension.
From the example I would try using atom boo64
as your File argument. If you want to remove the emulator from the program saved state, or examine that resource, check out the Sections linked at the bottom of this page.
来源:https://stackoverflow.com/questions/10126231/creating-a-saved-state-in-swi-prolog