SWI-Prolog as an embedded application in VS2008 C++
I have a C++ application (prog.sln) which is my main program and I want to use Prolog as an embedded logic server (hanoi.pl)
int main(int argc, char** argv)
putenv( "SWI_HOME_DIR=C:\\Program Files\\pl" );
argv = "libpl.dll";
argv = "-x";
argv = "hanoi.pl";
argv = NULL;
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 );
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 ),
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.