7.1   The HALCON Compiler hcomp

The HALCON compiler hcomp is the most important tool for creating a new HALCON package. It automatically generates the interface code for the desired host language, the help files, and the documentation files. hcomp processes def-files that contain descriptions of all operators as a basic resource, see chapter “Operator Description (def-file)”. The HALCON compiler uses the same mechanism for generating the original system operators and user-defined operators.

The syntax of the hcomp command is as follows:

           hcomp <options> <files>

Example:

           hcomp -u -H -ppackage MyUserOps.def

The parameter “-u” signals that an interface for user-defined operators should be generated. This parameter can be omitted as it is the default23). The option -H generates the main package interface code (Hpackage.c). One or more definition files that are separated by blanks must be specified as files argument. The extension .def may be omitted:

           hcomp -C -ppackage MyUserOps1 MyUserOps2 MyUserOps3

You either call hcomp in the directory of the def-files (typically the package subdirectory def) or specify the path to the def-files.

To use the package in a programming language, you must also generate the appropriate interface code. In the example above, the corresponding C files (HCpackage.c and HCpackage.h) are created with the option -C. Their names depend on the host language and the specified package, not on the names of the input def-files.

23) Note, that hcomp also is used by MVTec to generate the interface code for the normal HALCON system.