• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

2.20 Considerations (version 2)
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • A C++ interface to SWI-Prolog
        • A C++ interface to SWI-Prolog (Version 2)
          • Considerations (version 2)
            • The C++ versus the C interface (version 2)
            • Notes on exceptions
            • Global terms, atoms, and functors
            • Atom map utilities
            • Static linking and embedding (version 2)
            • Status and compiler versions (version 2)

2.20.1 The C++ versus the C interface (version 2)

Not all functionality of the C-interface is provided, but as PlTerm and term_t are essentially the same thing with type-conversion between the two (using the C_ field), this interface can be freely mixed with the functions defined for plain C. For checking return codes from C functions, it is recommended to use PlCheckFail() or PlCheck_PL().

Using this interface rather than the plain C-interface requires a little more resources. More term-references are wasted (but reclaimed on return to Prolog or using PlFrame). Use of some intermediate types (functor_t etc.) is not supported in the current interface, causing more hash-table lookups. This could be fixed, at the price of slighly complicating the interface.

Global terms and atoms need to be handled slightly differently in C++ than in C - see section 2.20.3

ClioPatria (version V3.1.1-48-gf653ce4)