12.2.3 library(shlib): Utility library for loading foreign objects (DLLs, shared objects)
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • Linking Foreign Modules
          • library(shlib): Utility library for loading foreign objects (DLLs, shared objects)
            • use_foreign_library/1
            • use_foreign_library/2
            • compat_arch/2
            • load_foreign_library/1
            • load_foreign_library/2
            • unload_foreign_library/1
            • unload_foreign_library/2
            • current_foreign_library/2
            • reload_foreign_libraries/0
    • Packages
Availability::- use_module(library(shlib)).(can be autoloaded)
Source[det]use_foreign_library(+FileSpec)
[det]use_foreign_library(+FileSpec, +Entry:atom)
Load and install a foreign library as load_foreign_library/1,2 and register the installation using initialization/2 with the option now. This is similar to using:
:- initialization(load_foreign_library(foreign(mylib))).

but using the initialization/1 wrapper causes the library to be loaded after loading of the file in which it appears is completed, while use_foreign_library/1 loads the library immediately. I.e. the difference is only relevant if the remainder of the file uses functionality of the C-library.

As of SWI-Prolog 8.1.22, use_foreign_library/1,2 is in provided as a built-in predicate that, if necessary, loads library(shlib). This implies that these directives can be used without explicitly loading library(shlib) or relying on demand loading.