HALCON Reference Manual 10.0.2
Table of Contents / Control ClassesClassesClasses | | | Operators

Page not available for the currently selected syntax (programming language).

Page not available for the currently selected syntax (programming language).

Page not available for the currently selected syntax (programming language).

Page not available for the currently selected syntax (programming language).

globalglobalglobalGlobalGlobal (Operator)

Name

globalglobalglobalGlobalGlobal — Declare a global variable.

Signature

global( : : Declaration : )

Herror global(const char* Declaration)

Herror T_global(const Htuple Declaration)

Herror global(const HTuple& Declaration)

void HOperatorSetX.Global([in] VARIANT Declaration)

static void HOperatorSet.Global(HTuple declaration)

Description

The globalglobalglobalGlobalGlobal statement can be used to declare a global variable. By declaring a variable as global the variable becomes visible to all other procedures that also declare the same variable explicitly as global.

If a variable is not explicitly declared as global inside a procedure, the variable is local within that procedure even if there is a global variable with the same name.

The parameter DeclarationDeclarationDeclarationDeclarationdeclaration contains the variable declaration that consists of the optional keyword 'def'"def""def""def""def", the type 'object'"object""object""object""object" or 'tuple'"tuple""tuple""tuple""tuple", and the variable name.

Setting the type to 'object'"object""object""object""object" an iconic variable is declared, by setting it to 'tuple'"tuple""tuple""tuple""tuple" a control variable is declared.

The keyword 'def'"def""def""def""def" allows to mark one declaration explicitly as the place where the variable is defined. In most cases this will not be necessary because in HDevelop the variable instance is created as soon as it is declared somewhere. However, if several procedures are exported to a programming language and if the procedures are not exported into one output file that contains all procedures together but into separate output files it will become necessery to mark one of the global variable declarations as the place where the variable is defined. A set of procedure export files that are linked to one library or application must contain exactly one definition of each global variable in order to avoid both undefined symbols and multiple definitions.

In the program listing, global variable declarations are displayed and must be entered without parenthesis in order to emphasize that the line is a declaration and not an executable operator. The syntax is as follows:

global [def] {object|tuple} <Variable Name>

Parameters

DeclarationDeclarationDeclarationDeclarationdeclaration (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Global variable declaration: optional keyword 'def'"def""def""def""def", type, and variable name

Suggested values: 'object'"object""object""object""object", 'tuple'"tuple""tuple""tuple""tuple", 'def object'"def object""def object""def object""def object", 'def tuple'"def tuple""def tuple""def tuple""def tuple"

Result

globalglobalglobalGlobalGlobal is never executed.

Module

Foundation


Table of Contents / Control ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH