Did you know ... Search Documentation:
Pack ffi -- prolog/clocations.pl
PublicShow source

This module provides the mapping from library names to concrete files that can be loaded. This is used by c_import/3. While C compilers typically allow one to specify a library as, e.g., -lm, the actual naming and physical location of the file providing this library is compiler and system dependent.

This module defines c_lib_path/2 to find the concrete file implementing a C library. Hooks may be used to extend this predicate:

  • library_path_hook/2 is called first by c_lib_path/2 and may redefine the entire process.
  • cpu_alias/2 may be used if ldconfig -p is used to verify that a library is compatible with the current architecture of the SWI-Prolog process.
 cpp(-Command, -Argv) is det
Provide the Command and Argv for process_create/3 to call the C proprocessor reading the C input from standard input.
 c_lib_path(+Spec, -Path, +Options) is det
Find a shared object from Spec. Spec is one of:
Concrete file
If spec is an atom or string denoting an existing file, this is used.
Alias(File)
Handled to absolute_file_name/3 using the options access(execute) and extensions(['',Ext]), where Ext is the value for the Prolog flag shared_object_extension
Plain atom
Platform dependent search. Currently implemented for
  • Systems that support ldconfig -p (e.g., Linux)

Additional search strategies may be realised by defining rules for library_path_hook/2 with the same signature.

To be done
- Extend the platform specific search strategies.
 ldconfig(?Name, ?Path, ?Version, ?Flags) is nondet
True when Name is the base name of a library in the ldconfig cache.
Arguments:
Name- is the base name of the library, without version or extension.
Path- is the absolute file name of the library
Version- is the version extension as an atom
Flags- is a list of atoms with flags about the library
 ldconfig_flush
Flush the library cache maintained for ldconfig.