For development, I set my PATH variable to the bin directory of my SWI Prolog package installation and wrote in my code :
if (!PlEngine.IsInitialized)
{
PlEngine.Initialize(new string[] { "" });
}
That worked fine.
Now, for deployment, I don't want the user to install the whole SWI-Prolog package. I want to copy what is needed at the right places and that everything remains transparent for the user.
As Jan Wielemaker told me, I successfully created a save state using qsave_program/2 :
qsave_program("save_state_stand_alone", [stand_alone(true),autoload(true),map(qsave)]).
Then, I called in my C# program :
if(!PlEngine.IsInitialized)
{
PlEngine.Initialize(newstring[] { "libswipl.dll", "-x", "save_state_stand_alone.exe"});
}
I also copied all the DLL contained in the "bin" directory next to my compiled release DLL.
I get the following error message : "The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
Is it the right thing to do? Can someone help me understand what I have to do?
Thanks a lot for your help.
Best regards
On Wednesday, June 8, 2016 at 11:48:03 AM UTC+2, M Vallée wrote:
PlEngine.Initialize(new string[] { "libswipl.dll", "-x", "mystate.exe" });
To create an executable that does not rely on Prolog one must create a saved state of the required Prolog code and attach this to the executable. Creating saved states is described with qsave_program/2 in the reference manual. This can be attached to a state using the DOS command below to createfinal.exe
from the executable produced by MSVC and the generated saved state.
> copy /b file.exe+file.state final.exe