SWI-Prolog 7.1.16 Reference Manual: Section 10.1

## 10.1 Limitations of qsave_program

There are three areas that require special attention when using qsave_program/[1,2].

- If the program is an embedded Prolog application or uses the foreign language interface, care has to be taken to restore the appropriate foreign context. See section 10.2 for details.

- If the program uses directives (`:- goal.` lines) that perform other actions than setting predicate attributes (dynamic, volatile, etc.) or loading files (consult, etc.), the directive may need to be prefixed with initialization/1.

- Database references as returned by clause/3, recorded/3, etc., are not preserved and may thus not be part of the database when saved.