Function to create a new global variable.
Creates the information in memory and, if required, also in retentive memory.
If requested, creates the definition file. Can also create an interface to the global variable.
Syntax |
i32 gv_create (string var, string dataType, i32 len, string wrtPsw, i32 flag, i32 gvID, buff) |
||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
var |
Variable name. Can contain letters, numbers, spaces, and special characters. Not case sensitive |
||||||||||||||||
dataType |
Description of data type. Can contain letters, numbers, spaces and special characters. If omitted (""), the data type will be inserted automatically |
||||||||||||||||
len |
Size in bytes of the global variable |
||||||||||||||||
wrtPsw |
Password for write access. If omitted (""), the password is not used |
||||||||||||||||
flag |
|
||||||||||||||||
gvID |
Local variable in which the function inserts the interface-related ID to the global variable. In case of an error, the function inserts 0 |
||||||||||||||||
buff |
Local buffer used as a cache connected to the ID (if any). It is used to update the global variable information during read and write operations. When the function is called, its value indicates the initialization value of the global variable. It must necessarily be the same size as the global variable |
||||||||||||||||
Result |
Returns:
|
||||||||||||||||
Validity |
Task |
||||||||||||||||
Note |
Example of use: Creating 2 GV: •global_1, attribute i32, size 4 bytes, no password, persistent, no initialization value •global_2, attribute undefined, size 2 bytes, password 123, only the first connected interface has write access, initialization value 5
Using gv_info from shell: |