Implementation of load_foreign_files/2

load_foreign_files/2 is implemented by constructing a shared object file and then using the same mechanism to load the shared object file as for load_foreign_executable/1. Under UNIX, the shared object file is constructed by the linker with a command similar to:

     % ld -G -o /tmp/ LinkFile ListOfFiles ListOfLibraries -lc

Under Windows, the command is similar to:

     C:\> link -dll -out:C:\tmp\qpnnnn.dll LinkFile ListOfFiles ListOfLibraries qpeng.lib libqp.lib -defaultlib:msvcrt

If any libraries are specified in ListOfLibraries then a LinkFile is generated that references all routines to be accessed by Prolog so that, if any of the specified libraries are static libraries, all the relevant object files will be included in the shared object file. In many cases no additional libraries are required and so ListOfLibraries = [] and no LinkFile is generated.

Note that when using languages other than C, various specific libraries may need to be included (such as -lpc or -lF77).