![]() |
| | #1 |
| Registered User Join Date: Mar 2010
Posts: 26
| SWI-Prolog as an embedded application in VS2008 C++ int main(int argc, char** argv) { putenv( "SWI_HOME_DIR=C:\\Program Files\\pl" ); argv[0] = "libpl.dll"; argv[1] = "-x"; argv[2] = "hanoi.pl"; argv[3] = NULL; PL_initialise(argc, argv); { fid_t fid = PL_open_foreign_frame(); predicate_t pred = PL_predicate( "hanoi", 1, "user" ); int rval = PL_call_predicate( NULL, PL_Q_NORMAL, pred, 3 ); PL_close_foreign_frame(fid); system("PAUSE"); } return 1; system("PAUSE"); } Here is my Prolog source code: :- use_module( library(shlib) ). hanoi( N ):- move( N, left, center, right ). move( 0, _, _, _ ):- !. move( N, A, B, C ):- M is N-1, move( M, A, C, B ), inform( A, B ), move( M, C, B, A ). inform( X, Y ):- write( 'move a disk from ' ), write( X ), write( ' to ' ), write( Y ), nl. I type at the command: plld -o hanoi prog.sln hanoi.pl But it doesn't compile. When I run my C++ app, it says: Undefined procedure: hanoi/1 What is missing/wrong in my code or at the prompt that prevents my C++ app from consulting Prolog? p.s. I am trying to use plld and avoid writing a separate dll. Thank you, |
| HJoshy is offline | |
![]() |
| Tags |
| swi-prolog, vs2008 c++ |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| coding and running application in C on mobile phone with Symbian | johnyjj2 | C Programming | 0 | 11-22-2009 11:23 AM |
| Problem with com application | amardon | C++ Programming | 3 | 10-06-2005 05:50 AM |
| Implementing portable user thread API to embedded microcontroller application | draggy | C Programming | 4 | 07-10-2005 02:01 PM |
| MFC run application by clicking on file... | dug | Windows Programming | 4 | 12-02-2004 04:33 AM |