Suppose I have the program below:
When I compile it, it links Prolog and C++ and then launches the Prolog command prompt.
PREDICATE( add, 3 )
return A3 = (long)A1 + (long)A2;
int main( int argc, char** argv )
PlEngine e( argv );
PlCall( "consult('myFile.pl')" );
PL_halt( PL_toplevel() ? 0 : 1 );
All I have in myFile.pl is
When I type listing at the Prolog prompt, I get
:- use_module( library(shlib) ).
So far, everything is simple and as expected. My question is how do I use the result of some other subroutine, say a class, in my foreign predicate add? Let's say I have a class somewhere in my program that calculates some x and y. Obviously x and y would be private or protected members of that class' header file. How do I use x and y in my add predicate? For instance, if I wanted to return the sum of x and y and first and second arguments of add?