Many applications use packages that include foreign language
components compiled to shared objects or DLLs. This code is normally
foreign file search path. Below is an example from
There are two options to handle shared objects in runtime
applications. The first is to use the
or the --foreign=save commandline option. This causes
the dependent shared objects to be included into the resource archive.
directive first attempts to find the foreign file in the resource
archive. Alternatively, the shared objects may be placed in a directory
that is distributed with the application. In this cases the file search
foreign must be setup to point at this directory. For
example, we can place the shared objects in the same directory as the
executable using the definition below. This may be refined further by
adding subdirectories depending on the architecture as available from
the Prolog flag arch.
:- multifile user:file_search_path/2. user:file_search_path(foreign, Dir) :- current_prolog_flag(executable, Exe), file_directory_name(Exe, Dir).