Download HDevelop User`s Manual
Transcript
250 Code Export 8.1.1 Basic Steps 8.1.1.1 Program Export The first step is to export the program using the menu File . Export.... Here, select the language (C++ - HALCON/C++) and save it to a file. A file will be created that contains the HDevelop program as C++ source code. For every HDevelop procedure except the main procedure, the exported file contains a C++ procedure with the corresponding name. Iconic input and output parameters of a procedure are declared as Hobject and Hobject*, respectively, while control input and output parameters are declared as HTuple and HTuple*, respectively. All procedures are declared at the beginning of the file. The program body of the HDevelop main procedure is contained in a procedure action() which is called in the function main(). action() and main() can be excluded from compilation by inserting the instruction #define NO_EXPORT_MAIN at the appropriate position in the application. Using the instruction #define NO_EXPORT_APP_MAIN only the main() procedure is excluded from compilation. This can be useful if you want to integrate exported HDevelop code into your application through specific procedure interfaces. In that case, there is typically no need to export the main procedure, which was probably used only for testing the functionality implemented in the corresponding ’real’ procedures. Besides the program code, the file contains all necessary #include instructions. All local variables (iconic as well as control) are declared in the corresponding procedures. Iconic variables belong to the class Hobject and all other variables belong to HTuple. 8.1.1.2 Compiling and Linking in Windows Environments The next step is to compile and link this new program. In the Windows environment, Visual C++ is used for the compiling and linking. Example projects can be found in the directory %HALCONROOT%\ examples\cpp. If you want to use HALCON XL, you have to include the libraries halconxl.lib/.dll and halconcppxl.lib/.dll instead of halcon.lib/.dll and halconcpp.lib/.dll in your project (see the Programmer’s Guide, chapter 7 on page 71, for more details). 8.1.1.3 Compiling and Linking in UNIX Environments To compile and link the new program (called, e.g., test.cpp) under UNIX, you can use the example makefile, which can be found in the directory $HALCONROOT/examples/cpp , by calling make PROG=test Alternatively, you can set the variable PROG in makefile to test and then just type make. You can link the program to the HALCON XL libraries by calling make PROG=test XL=1 or just type make XL=1 if you set the variable PROG as described above. For more details see the Programmer’s Guide, chapter 7 on page 71.