Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7594673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:28:44+00:00 2026-05-30T21:28:44+00:00

I am calling a SWI Prolog engine from a C++ dll and I would

  • 0

I am calling a SWI Prolog engine from a C++ dll and I would like to be able to access all asserted/dynamic predicates (similar to what listing normally does).

In GNU Prolog I would call the dynamic/1 predicate with a Variable and Prolog would unify it with all dynamic predicate indicators. In the next step I would call these predicates with variables and get a complete list.

Unfortunately I can’t do that in SWI Prolog (ERROR: Arguments are not sufficiently instantiated).
Is there another way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:28:45+00:00Added an answer on May 30, 2026 at 9:28 pm

    Why not just roll your own, for example:

    get_dynamic_predicates(M, H, B, R) :-
        current_predicate(_, P),
        strip_module(P, M, H),
        predicate_property(P, dynamic), 
        \+ predicate_property(P, built_in), 
        \+ predicate_property(P, imported_from(_)),
        clause(P, B, R).
    

    Calling this backtracks to bind instances of predicates with head H in module M with body B and clause reference R. If all you wanted to retrieve are the names of the dynamic predicates, you could call this to retrieve the set of all bindings for H, or the functors thereof.

    Modify the predicate properties to those you’d prefer (or better yet, pass them in as arguments); the above definition will retrieve all user-defined dynamic predicates, which is what I’m guessing you’re after.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Calling all AutoMapper gurus! I'd like to be able to map object A to
Calling all the PHP helpers out there. So basically I would like to give
Calling Html.RenderPartial(~/Views/Payments/MyControl.ascx); from a view works if MyControl.ascx is a control that directly inherits
Calling urrlib2.urlopen on a link to an article fetched from an RSS feed leads
When calling functions that always throw from a function returning a value, the compiler
Calling concat on vectors returns a list. Being a total noob I would expect
Calling a .net SOAP1.1 web service from android using ksoap2 lib I met a
Calling Thread.join blocks the current (main) thread. However not calling join results in all
Calling all JS historians. A common pattern is to alias a class' prototype to
Calling the UDF like so: SELECT product_name, SUM(quantity) AS SumQty, SUM(face_value) AS SumFaceValue, SUM(net_cost)AS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.