structs package is divided into two parts:
structspredicates (other than the
The former file is not (usually) needed while your application is
running, while the latter part certainly is. By separating
into two files, you may avoid including the
structs declaration code
in your application.
In order to declare a foreign type or use foreign types in a
foreign function declaration, you must first load the file
library(structs_decl). Ordinarily, you would probably do this by
use_module/[1,2,3] call in your file.
Unfortunately, this will not allow
qpc to compile your file. In order
both to use your file in the development system, and to compile it with
qpc, put the following line in your files that define foreign types or
use foreign types in foreign function declarations:
:- load_files(library(structs_decl), [when(compile_time),if(changed)]).
qpc to load
qpc, and not
to record a dependency on it. This means that
library(structs_decl) will not be
part of your statically linked application.
If you accidentally use
it will compile in the development system, but when you
qpc the file you will
get a warning.
Files that just use
structs are much simpler. Just add this to those files:
There is another important complication. If you have type declarations in one file (call it A) that use types declared in another file (B), you must declare (at least) a compile_time dependency. So in file A, you'd need to have the line:
:- load_files('B', [when(compile_time),if(changed)]).
This does not allow predicates in A to call predicates in B. If you need this, too, you should instead include in file A the line:
:- load_files('B', [when(both),if(changed)]).
You will also need to ensure that B is compiled to a QOF file before
qpc A. This requires that if A is a module-file, so must B be.
If A is not a module-file, then B need not be a module-file (but it may
be). If you use the
make utility to maintain object files, you
might then want to add the following line to your