Besides the restrictions mentioned in this section and in section “General Aspects of Code Generation”, please also check the description of the HDevelop operators in section “Menu 算子”.
In HDevelop, every exception normally causes the program to stop and report an error message in a dialog window. This might not be useful in C++. The standard way to handle this in C++ is by using the try-catch mechanism. This allows you to access the reason for the exception and to continue accordingly. HDevelop supports exception handling using try-catch blocks, which is exported transparently to C++. Therefore, it is the recommended method of handling errors in HDevelop programs that are going to be exported to C++.
For HDevelop programs containing error handling using dev_set_check('~give_error') (or set_check('~give_error')), the corresponding code is automatically included. Every operator call, for which it is assumed that the HALCON error mechanism is turned off, is enclosed in a try block followed by a catch block. The latter handles the exception and assigns the corresponding HALCON error number to the error variable activated by dev_error_var or to a local error variable otherwise.
Please note that a call of dev_set_check('~give_error') has no influence on the operator call. The exception will always be raised.