• 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.5 Overview (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)
          • Overview (version 2)
            • Design philosophy of the classes
            • Summary of files
            • Summary of classes
            • Wrapper functions
            • Naming conventions, utility functions and methods (version 2)
            • Blobs
            • Limitations of the interface
            • Linking embedded applications using swipl-ld

2.5.8 Linking embedded applications using swipl-ld

The utility program swipl-ld (Win32: swipl-ld.exe) works with both C and C++ programs. See Linking embedded applications using swipl-ld for more details.

Your C++ compiler should support at least C++-17.

To avoid incompatibilities amongst the various C++ compilers' ABIs, the object file from compiling SWI-cpp2.cpp is not included in the shared object libswipl; instead, it must be compiled along with any foreign predicate files. You can do this in three ways:

  • Compile SWI-cpp2.cpp separately.
  • Add #include SWI-cpp2.cpp to one of the foreign predicate files.
  • Wherever you have #include SWI-cpp2.h, add
          #define _SWI_CPP2_CPP_inline inline
          #include <SWI-cpp2.cpp>
      

    This will cause the compiler to attempt to inline all the functions and methods, even those that are rarely used, possibly resulting in some code bloat.

ClioPatria (version V3.1.1-48-gf653ce4)