Restriction on Compile-Time Code

Since qpc is itself a runtime system, any code to be run at compile-time must obey the same restrictions as for any other runtime system. In particular, foreign code cannot be loaded into qpc with load_foreign_executable/1 or load_foreign_files/2. However, you can load QOF files into qpc, and if the QOF file has object file dependencies, they will be loaded also. For example, you might compile with qpc to get file.qof:

:- load_foreign_file([prog1], []) :- load_foreign_executable(prog2)
... <dependency on object file prog1> ... ... <dependency on shared object file prog2> ...

In this case, and file.qof both depend on the same object files. However, while a runtime system can load file.qof, it cannot load, because load_foreign_executable/1 and load_foreign_files/2 are not available in the runtime kernel.