From jan@swi.psy.uva.nl Fri May 25 11:37:20 2001
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f4P9bK311694;
	Fri, 25 May 2001 11:37:20 +0200 (MET DST)
Received: (from jan@localhost)
	by gollem.swi.psy.uva.nl (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id f4P9bJG23350;
	Fri, 25 May 2001 11:37:19 +0200
Date: Fri, 25 May 2001 11:37:19 +0200
Message-Id: <200105250937.f4P9bJG23350@gollem.swi.psy.uva.nl>
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Subject: Re: [SWIPL] libraries written in Prolog
To: SWI-PL <prolog@swi.psy.uva.nl>, prolog-request@swi.psy.uva.nl
Phone: +31 - 20 - 525 6121

Bill,

> I am writing a speech synthesizer in Prolog. I am 
> writing it to be very extendable. I would like to have parts
> of it compiled as libraries that can be used to build other 
> applications (much like an SDK). Is this something that
> can be done in Prolog?

Talking SWI-Prolog, as the details will vary from system to system.
Normally I would simply stick all the stuff in a directory, make sure
all files are module files (but really, once you start thinking of
code that should be used more than just once you should use modules).
Now run ?- make_library_index(mydir). to create an INDEX.pl.

Now all you have to do is add this directory to the library search
path by adding a rule to user:file_search_path/2.

At least for SWI-Prolog there is little reason to compile it, unless
it is *really* big.  In that case you can use qcompile/1 to compile
(part of) the library to .qlf files.  .qlf files require about 10
times less CPU time to load, but in practice the time for locating,
opening and reading the file outweights on typical source-files.
The .qlf format is highly version dependant as it is just a dump
of the virtual-machine instructions.

You can have a look at how the XPCE library is added to the system.

	Cheers --- Jan

P.s.	In a wider context I'm a bit worried on these issues.  Using
	file_search_path/2 is a great way to organise the file-structure,
	but the module name-space and public predicate namespaces are
	flat.

	If we just keep adding modules to the library, eventually it
	will become unmanagable.  I'm seeking for solutions that
	preferably fit with some kind of standard.

