SWI-Prolog 7.4.2 Reference Manual: Section 12.1

## 12.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 12.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.