The incremental linker is highly system dependent. It can easily be ported to machines for which the C linker allows you to link an object file using the symbol table of a (running) executable and use BSD Unix format a.out files. On many Unix systems such an object file can be created using the -A option of ld(1). Some operating systems offer primitives for dynamic loading (AIX, MACH). The following call may be used to find out whether load_foreign is functional:
?- feature(load_foreign, OK).
Entry defines the entry point of the resulting executable. The entry point will be called by Prolog to install the foreign predicates.
$(CC) -N -A <symbolfile> -T <offset> -e <entry> -o <executable> <files> -lc
The options are inserted just before the files. Libraries is (a list of) libraries to be passed to the loader. They are inserted just after the files.
If Size is specified Prolog first assumes that the resulting executable will fit in Size bytes and do the loading in one pass. If the executable turns out to be larger than Size bytes the loading sequence is started again, using the calculated size. To determine the size of an executable specify a size that is too small. Prolog will then print the actual size on the current output stream.