Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Calling C++ function from Prolog and return values in parameters

I need help!
I want to call from Prolog, a function defined in C ++ and return values back to Prolog parameters.
How I to do it? Write an example if you know!

pro_to_cpp_fun(T1, T2, T3, T4, T5 .... ),
write(T1), % T1 = 10
write(T2), % T2 = 27.3
write(T3), % T3 = "hello"
write(T4), % T4 = 'hello'
write(T5), % T5 = list of values


pro_to_cpp_fun(T1, T2, T3 .... )
!!! How to Record a Values in: T1, T2, T3, T4, T5 ....
T1 = 10 // ?
T2 = 27.3 // ?
T3 = "hello" // ?
T4 = 'hello' // ?
T5 = list of values // ?


  • Look in the Logic Server User's Guide for details on this. Basically, you don't make a call as you describe. Instead, you create an extended predicate in C++ that you can then call from Prolog. In other words, you don't call out directly, but rather, in C++ you can write predicates that are callable from Prolog. See documentation for details.
Sign In or Register to comment.