The interface defined in this section allows the user to load shared
.so files on most Unix systems,
files on Windows). This interface is portable to Windows as well as to
Unix machines providing dlopen(2) (Solaris, Linux,
FreeBSD, Irix and many more) or shl_open(2) (HP/UX). It
is advised to use the predicates from section
9.2.3 in your application.
- open_shared_object(+File, -Handle)
- File is the name of a shared object file (DLL 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 open_shared_object/3 and load_foreign_library/1.
On errors, an exception
shared_object(Action, Message)is raised. Message is the return value from dlerror().
- 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.
nowimplies the symbols are resolved immediately rather than lazy (default).
globalimplies 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.
- Detach the shared object identified by Handle.
- 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. Normally this function installs foreign language predicates using calls to PL_register_foreign().