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
called, before Resource is loaded.
An example of usage of
load_foreign_resource/1 can be found in its
reference page, mpg-ref-load_foreign_resource.
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
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 function
)cannot be used if func is defined in a dynamically linked foreign resource.