load_foreign_resource(
:Resource)
Unless a foreign resource with the same name as Resource has been statically linked, the linked foreign resource specified by Resource is linked into the Prolog load image. In both cases, the predicates defined by Resource are installed, and any init function is called. Dynamic linking is not possible if the foreign resource was linked using the --static option.
If a resource with the same name has been previously loaded, it will be
unloaded, as if unload_foreign_resource(
Resource)
were
called, before Resource is loaded.
unload_foreign_resource(
:ResourceName)
If no resource named ResourceName is currently loaded, an existence error is raised.
For backward compatibility, ResourceName can also be of the same
type as the argument to load_foreign_resource/1
. In that
case the resource name will be derived from the absolute file name in
the same manner as for load_foreign_resource/1
. Also for backward
compatibility, unload_foreign_resource/1
is a
meta-predicate, but the module is ignored.
Please note: all foreign resources are unloaded before Prolog exits. This implies that the C library functionatexit(
func)
cannot be used if func is defined in a dynamically linked foreign resource.
The following predicates are provided for backwards compatibility and should be avoided in new code:
foreign_file(
+File,
+Functions)
hook,obsolescentload_foreign_files/2
.
load_foreign_files(
:ObjectFiles,
+Libraries)
development,hookable,obsolescent