C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 19th, 2003, 08:43 AM
liv liv is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 3 liv User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
execute Prolog from C program

hiya,

I was wondering how I can call a Prolog query from a C program.
The Prolog compiler that I'm using is LPA's WinProlog and I'm using code warrior for the C code.
I would like to be able to query the prolog code and get back a result.

any ideas???

Reply With Quote
  #2  
Old April 19th, 2003, 11:50 AM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is offline
Contributing User
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 3,824 dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 1 h 9 m 26 sec
Reputation Power: 446
My immediate response is to tell you to read WinProlog's documentation for that. I say that, because such capabilities rely more on the implementation than on general language features. For example, my only prolog experience was with Borland's Turbo Prolog; Turbo Prolog could call C functions, but a C program could not call Turbo Prolog.

I just did a quick Google on WinProlog and found this statement at http://www-lp.doc.ic.ac.uk/UserPage...l/lpa/lpa1.html :
Quote:
DLL Interface. Allows Prolog to call, or be called by, programs written in C, Pascal, etc. Synchronous and asynchronous message passing is supported.

So that tells me that it can be done. That's half the battle.

At the company's website, http://www.lpa.co.uk/win_det.htm , I read:
Quote:
Direct Windows API Interface

As well as providing high-level access to around 100 Windows API (Application Programming Interface) functions, not to mention numerous subfunctions, WIN-PROLOG includes a special interface which allows your programs to call virtually any C function directly, whether defined in the Windows API or in a DLL or other module. The winapi/3 predicate allows any function, defined in any 32-bit module, to be called with any number of parameters. The parameters may be integers, string pointers, or arbitrary structures, and facilities exist for defining named "memory files". All memory allocation and stack frame creation is carried out automatically, so your only job as a programmer is to provide the relevant data and call the function.

The Windows API function means that your programs are no longer "limited" to using the 100-plus API functions built into WIN-PROLOG by LPA, but can add additional functions yourself as and when you need them. It also provides a direct way to invoke code in DLLs, without having to write parameter-translating ("glue") code in C/C++.


So somewhere there has to be an API defined for that DLL and the only place I can think of would be in the documentation somewhere.

Some of the messages in the comp.lang.prolog newsgroup mention WinProlog, so that might be a place to post your question as well. I usually access the newsgroups through Google. Google also has a search engine for the newsgroups, so you can search through past messages.

Last edited by dwise1_aol : April 19th, 2003 at 11:53 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > execute Prolog from C program


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway