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 file.pl with qpc to get file.qof:

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

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