YAP 7.1.0
Access to Foreign Language Programs

Detailed Description


Class Documentation

◆ load_foreign_files/3

class load_foreign_files/3

load_foreign_files( Files, Libs, InitRoutine)

should be used, from inside YAP, to load object files produced by the C compiler The argument ObjectFiles should be a list of atoms specifying the object files to load, Libs is a list (possibly empty) of libraries to be passed to the unix loader (ld) and InitRoutine is the name of the C routine (to be called after the files are loaded) to perform the necessary declarations to YAP of the predicates defined in the files

YAP will search for ObjectFiles in the current directory first If it cannot find them it will search for the files using the environment variable:

  • YAPLIBDIR

if defined, or in the default library available as YAP supports the SWI-Prolog interface to loading foreign code, the shlib package

◆ load_absolute_foreign_files/3

class load_absolute_foreign_files/3

load_absolute_foreign_files( Files, Libs, InitRoutine)

Loads object files produced by the C compiler It is useful when no search should be performed and instead one has the full paths to the Files and Libs

◆ open_shared_object/2

class open_shared_object/2

open_shared_object(+ File, - Handle)

File is the name of a shared object file (called dynamic load library in MS-Windows) This file is attached to the current process and Handle is unified with a handle to the library Equivalent to open_shared_object(File, [], Handle) See also load_foreign_library/1 and load_foreign_library/2

On errors, an exception shared_object( Action, Message) is raised Message is the return value from dlerror()

◆ open_shared_object/3

class open_shared_object/3

open_shared_object(+ File, - Handle, + Options)

As open_shared_object/2 , but allows for additional flags to be passed Options is a list of atoms now implies the symbols are resolved immediately rather than lazily (default) global implies symbols of the loaded object are visible while loading other shared objects (by default they are local) Note that these flags may not be supported by your operating system Check the documentation of dlopen() or equivalent on your operating system Unsupported flags are silently ignored

◆ call_shared_object_function/2

class call_shared_object_function/2

call_shared_object_function(+ Handle, + Function)

Call the named function in the loaded shared library The function is called without arguments and the return-value is ignored YAP supports installing foreign language predicates using calls to 'UserCCall(), PL_register_foreign()`, and friends