From jan@swi.psy.uva.nl Fri Feb 11 14:05:03 2000 Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30]) by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id OAA07521; Fri, 11 Feb 2000 14:05:03 +0100 (MET) Received: (from jan@localhost) by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id OAA11087; Fri, 11 Feb 2000 14:05:23 +0100 Date: Fri, 11 Feb 2000 14:05:23 +0100 Message-Id: <200002111305.OAA11087@gollem.swi.psy.uva.nl> From: Jan Wielemaker Subject: Re: How to build a Runtime which loads a *.qlf with foreign code ? To: Lesta@t-online.de (Uwe Lesta), prolog@gollem.swi.psy.uva.nl In-Reply-To: Uwe Lesta's message of Fri, 11 Feb 2000 12:37:09 +0100 Phone: +31 - 20 - 525 6121 > The main part off my Application is now loaded into the module user. > In the other part (a qlf which is loading at runtime) I'll > import the predicates via import ... > This qlf file uses the foreign code from swiactx.dll > > Is this generally possible ? Sure > If yes, where I'll have to pay attention to ? The generally adviced way is to use file_search_path/2 with the type foreign: :- initialization load_foreign_library(foreign(swiactx)). Now, may sure swiactx.dll is either in the `foreign' search path (see docs on file_search_path/2) or in a location searched by the system. For runtime systems under Windows I normally install dll's in the same directory as the executable itself, which is the first location Windows examines. > Here are the errors : > > [WARNING: d:/lesta/swi-pl/pl-prog/lib/swiactx/swiactx.pl:214: > (loading d:/uwef&e/wissen/marquard&schulz/init.qlf) > directive failed: > swiactx: (initialization load_dll)] > [WARNING: d:/lesta/swi-pl/pl-prog/lib/xpce_ado/xpce_ado.pl:23: > (loading d:/uwef&e/wissen/marquard&schulz/init.qlf) > directive failed: > xpce_ado:swiactx:actxErrorsAsExceptions(true)] > [WARNING: d:/uwef&e/wissen/marquard&schulz/artikel_suche.pl:582: > (loading d:/uwef&e/wissen/marquard&schulz/init.qlf) > directive failed: > artikel_suche: (initialization store_pg_cube)] > % d:/uwef&e/wissen/marquard&schulz/init.qlf loaded into > marquard_schulz_wissen 0.00 sec, 265,092 bytes > [WARNING: pce_global/2: Goal failed: user:_G868] > > An other problem: > If i'll use a qlf without foreign code I'll get only the error: > [WARNING: pce_global/2: Goal failed: user:_G868] > but before, the predicate default(Persist, @off, Pers), > in a initialise method of the qlf code fails silent. > I think it is not known. I don't really get this. Using the patch below on xpce/prolog/boot/pce_global.pl (and redo the boot compilation by dragging setup.pl onto plwin.exe in the bin directory) you should get better error messages. Index: pce_global.pl =================================================================== RCS file: /usr/local/cvsroot/xpce/prolog/boot/pce_global.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- pce_global.pl 1999/07/16 14:06:18 1.4 +++ pce_global.pl 2000/02/11 12:59:46 1.5 @@ -1,4 +1,4 @@ -/* $Id: pce_global.pl,v 1.4 1999/07/16 14:06:18 jan Exp $ +/* $Id: pce_global.pl,v 1.5 2000/02/11 12:59:46 jan Exp $ Part of XPCE Designed and implemented by Anjo Anjewierden and Jan Wielemaker @@ -93,17 +93,15 @@ ; Goal =.. List, append(List, [@Ref], GoalList), GoalTerm =.. GoalList, - Module:GoalTerm + ( Module:GoalTerm -> true ; format(user_error, '[WARNING: pce_global/2: Goal failed: ~w:~w]~n', [Module, GoalTerm]), trace, fail + ) ). trap_ref(Ref) :- 'pce catcher'(Module, Goal), - Goal =.. List, - append(List, [@Ref], GoalList), - GoalTerm =.. GoalList, - Module:GoalTerm. + call(Module:Goal, Ref). > What is the recommended way to find out all used predicates ? > And how to import them ? See 'Insert require directive' in PceEmacs. Regards --- Jan