Thank you Ann. This is exactly what is needed.
Although I have Thom Frühwirth’s book, the application-level question on “how can this actually be called from Prolog” stays opaque and the SWI Prolog manual does not really help. I’m trying some coding now.