Re: Modules, include paths, swipl-ld etc

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
[keeping this on the list]

On 01/29/2014 12:08 AM, Kaitain Jones wrote:
> On Tue, Jan 28, 2014 at 2:10 PM, Jan Wielemaker <[email protected]
> <mailto:[email protected]>> wrote:
>
>>I think all the above is answered?
>
> Partially. Certainly much appreciated. But I still don't quite
> understand how my Win32 exe is autoloading the stuff at the moment, and
> if there's one thing I dislike more than a program not working for
> reasons I don't understand, it's a program WORKING for reasons I don't
> understand.

:-)  Well,. by default SWI-Prolog tries to be smart (or helpful).  You
can change that, either by asking it to tell you what it is doing
or by switching it off.  The the various Prolog flags that control
autoload.

> Specifically, I am not sure how my exe knows how to find the file it
> needs. By renaming swipl32/library/lists.pl <http://lists.pl>, it became
> clear that it clearly WAS finding and using this file. (Execution failed
> after the rename.) But I have not told it directly about the existence
> of swipl32/library. I told it where swipl32/lib/libswipl.lib was. I told
> it to add the ../swipl32/bin directory to the path (so it could find the
> DLLs). I also added swipl32/include as an additional include directory
> so it could find the main header file for the foreign interface
> (SWI-Prolog.h). Is it conducting some kind of relative directory-walking
> exploration to try to find a useable file? If so, based off what? (I
> tried moving lists.pl <http://lists.pl> into parent and sibling
> directories, and into the directories I HAD added to the path, but it
> seemed that the system specifically wanted it in "library".)

The process for finding the Prolog `home' is here:

http://www.swi-prolog.org/pldoc/doc_for?object=section%28%27sec:findhome%27%29

The new autocompletion on the website finds it quickly.

Note that the system runs fine without a `home', but only has the
stuff that is loaded in the saved state.  For development in an embedded
system, it is most likely handy to provide access to the home.  That also
saves the trouble of re-creating the state and restarting the program.
You can also create a telnet server in Prolog (see prolog_server/2) and
telnet into the running system to examine the state or (re-)load files.
For final deployment you either have no home or provide a stripped down
or extended home with things you wish to load on demand.

	Cheers --- Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.