Subject: Re: [SWIPL] loading foreign files

From: Jan Wielemaker <[email-masked]>
Date: Tue, 11 Dec 2001 13:26:16 +0100

On Tue, 11 Dec 2001, Ioannis Partsakoulakis wrote:
>There is a predicate start/2 that loads another file that is specified by
>the user:
>
>start(InputFile,Message):-
>    consult(InputFile),
>    ...
>
>The file containing the start predicate definition is contained in a qlf
>file and that qlf file is loaded into memeory with PL_initialize in a C++
>application. When I call start with PLQuery the application cannot find the
>file specified (ex. source_sink 'test.pl' does not exist) although I know
>its there.

Little clue.  Maybe the working directory is different between the two
setups?  If the application can access a terminal/console, try adding
a call to trace/0 in the program to allow you debugging:

start(InputFile, Message) :-
	trace,
	consult(InputFile_,
	...

Use `b' (break) to enter the toplevel, check the environment using pwd/0
and/or ls/0.  If we are talking Unix try to run the program under the
system call-tracer (strace on Linux, truss on Solaris, check manual on
others) to see what files it is trying to open where.

>Prolog runs with no problem the start predicate when not embedded in the C++
>application.
>
>PLQuery does fine when I am not trying to load some file in that way.
>
>If I consult the InputFile with :-consult('test.pl') then the file is loaded
>withing the qlf file. However I want to change the InputFile and the program
>to change behavior.

What does it mean to load a file within a qlf file??

	--- Jan