Complex query with multiple solutions from c ++

I’m using: SWI-Prolog version 8.0.3-1 for Microsoft Windows (64 bit)
Simple example:

parent(pam,bob).
parent(tom,bob).
parent(tom,liz).
parent(bob,ann).
parent(bob,pat).
parent(pat,jim).

I want to use the c ++ interface to access the database, get all the available solutions and then manipulate them in c ++.
I found the PlQuery and PlCall class descriptions in the manual. But I do not understand how to execute such a request with their help.

parent(tom,X),parent(X,Y).

PlCall looks very good but it does not display all the solutions.
Any ideas …

I can not answer this as I have never used the C++ interface.

This has been also posted at StackOverflow.

The best advice is: don’t. Instead, make sure the Prolog program that provides a suitable predicate with nice simple arguments. That saves a lot of typing. So, in the above you add

grand_parent(Me, GrantParent) :-
    parent(Me, Parent),
    parent(Parent, GrandParent).

If you really want/need, create a goal using the various term manipulation primitives where, in this case, the outermost term is ,/2 and pass this term to the built-in call/1.