Article View: comp.lang.prolog
Article #233Re: A question about Quintus and external lang interfaces
From: Jianhua Zhu
Date: Thu, 29 Jun 1989 02:11
Date: Thu, 29 Jun 1989 02:11
40 lines
2583 bytes
2583 bytes
In article <Jun.27.14.28.58.1989.250@caip.rutgers.edu> russo@caip.rutgers.edu (Mark F. Russo) writes:
>I have a question about Quintus Prolog and the latest functionality of
>the external language interface. I know that you can install a C
>function as a predicate call in a Quintus Prolog program. My question
>is, can you then make a query back into the prolog database from that
>external C function.
I have used Quintus Prolog version 2.0 (which may not be the latest
version) on Tektronix UTEK machines. As far as I know, you can not
call back into prolog from a foregn language routine directly. However,
you can achieve this effect indirectly.
In addition to foreign language interfaces, Quintus Prolog also provides
a set of IPC libraries that allow you to run multiple processes
communicating with each other. In particular, you can have a C master
process and a Prolog servant process running at the same time, and you
can call Prolog predicates from the C process.
The following scheme would provide you with one way to indirectly
implement the kind of invocation pattern you described (a rather
painful indirection, though):
+------------+-------+ +-------+------------+
| | IPC-1 |<======>| IPC-1 | Prolog |
| C +-------| +-------+ Servant |
| Master | | Process |
| Process +-------+ +-------+---------+ |
| | IPC-2 |<======>| IPC-2 | C | |
+------------+-------+ +-------+ Foreign | |
| Routines | |
+-----------------+--+
where IPC-1 is the system provided IPC facility, IPC-2 is a different set
of communication routines you have to write yourself.
--
/__|__ _/-\_ | /__|__ Jianhua Zhu UUCP : tektronix!ogccse!zhu
"___|__, --- || /| ,|_/ CSE Dept -- OGC CSNet: zhu@cse.ogc.edu
,"|", \|/ || ---+--- 19600NW von Neumann Dr Phone: (503) 690-1121 x7395
/ \| \ /--- \| | Beaverton, OR 97006
Technical Details
Message-ID:
<3451@ogccse.ogc.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!uw-beaver!blake!ogccse!zhuReferences:
<Jun.27.14.28.58.1989.250@caip.rutgers.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!uw-beaver!blake!ogccse!zhu From: zhu@ogccse.ogc.edu (Jianhua Zhu) Newsgroups: comp.lang.prolog Subject: Re: A question about Quintus and external lang interfaces Keywords: Quintus, external language interfaces Message-ID: <3451@ogccse.ogc.edu> Date: 29 Jun 89 02:11:58 GMT References: <Jun.27.14.28.58.1989.250@caip.rutgers.edu> Reply-To: zhu@ogccse.UUCP (Jianhua Zhu) Organization: Oregon Graduate Center, Beaverton, OR Lines: 40