12.4 The Foreign Include File
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • The Foreign Include File
          • Argument Passing and Control
          • Atoms and functors
          • Analysing Terms via the Foreign Interface
          • Constructing Terms
          • Unifying data
          • Convenient functions to generate Prolog exceptions
          • Foreign language wrapper support functions
          • Serializing and deserializing Prolog terms
          • BLOBS: Using atoms to store arbitrary binary data
          • Exchanging GMP numbers
          • Calling Prolog from C
          • Discarding Data
          • String buffering
          • Foreign Code and Modules
          • Prolog exceptions in foreign code
          • Catching Signals (Software Interrupts)
          • Miscellaneous
          • Errors and warnings
          • Environment Control from Foreign Code
          • Querying Prolog
            • PL_query()
          • Registering Foreign Predicates
          • Foreign Code Hooks
          • Storing foreign data
          • Embedding SWI-Prolog in other applications
    • Packages

12.4.20 Querying Prolog

long PL_query(int)
Obtain status information on the Prolog system. The actual argument type depends on the information required. int describes what information is wanted.221Returning pointers and integers as a long is bad style. The signature of this function should be changed. The options are given in table 9.
PL_QUERY_ARGC Return an integer holding the number of arguments given to Prolog from Unix.
PL_QUERY_ARGV Return a char ** holding the argument vector given to Prolog from Unix.
PL_QUERY_SYMBOLFILE Return a char * holding the current symbol file of the running process.
PL_MAX_INTEGER Return a long, representing the maximal integer value represented by a Prolog integer.
PL_MIN_INTEGER Return a long, representing the minimal integer value.
PL_QUERY_VERSION Return a long, representing the version as 10,000 × M + 100 × m + p, where M is the major, m the minor version number and p the patch level. For example, 20717 means 2.7.17.
PL_QUERY_ENCODING Return the default stream encoding of Prolog (of type IOENC).
PL_QUERY_USER_CPU Get amount of user CPU time of the process in milliseconds.
Table 9 : PL_query() options