Skip to main content

Operator: Library Namespace

Syntax: <library namespace>.<library POU identifier>

Example: LIB_A.FB_A

A library POU identifier is appended with the library namespace (as a prefix separated by a dot) for unique and qualified access to the library POU. The namespace usually matches the library name.

Example 161. Example

A library is included in a project and contains the FB_A POU. However, the function block with the same name is already available locally in the project. Identify the library POU as LIB_A.FB_A in order to access the library POU, not the local function block.

var1 := FB_A(in := 12); // Call of the project function FB_A
var2 := LIB_A.FB_A(in := 22); // Call of the library function FB_A


You can define another identifier for the namespace. To do this, specify a namespace in the project information (library developers: when creating a library project). Alternatively, you could also specify a specific namespace for a library in the Library Manager in the Properties dialog (application developers: when creating an application).

For more information, see: Using Libraries

Operator (#) for direct access

The operator is an extension of the IEC 61131-3 standard.

It is possible that local components of a function block override library POUs with the same name, which causes ambiguity. As a result, access with the usual namespace convention is not possible. Then it is helpful to use the # operator to force direct access.

You can use the following syntax to force direct access:

Syntax: <namespace> # <library POU path>

Example 162. Example
TYPE Struct1 :
STRUCT
	Standard : Struct2;
END_STRUCT
END_TYPE
TYPE Struct2 :
STRUCT
	Concat : DINT;
END_STRUCT
END_TYPE
{attribute 'qualified_only'}
VAR_GLOBAL
	Standard : Struct2;
END_VAR
PROGRAM PLC_PRG
VAR
    test : _3S_License#Standard#TON;
    str : STRING;
END_VAR

// access to global variable
_3S_License.Standard.CONCAT := 123;

// with hashtag access, the library is explicitly addressed 
str := _3S_License.Standard#CONCAT('test1', '3444');
str := Standard#CONCAT('test1', '3444');
str := _3S_License#Standard#CONCAT('test1', '3444');
str := _3S_License.Standard#CONCAT('test1', '3444');
str := CONCAT('test1', Standard#CONCAT('3444', '444'));
str := CONCAT('test1', _3S_License.Standard#CONCAT('3444', '444'));
str := CONCAT('test1', _3S_License#Standard#CONCAT('3444', '444'));
str := Standard#CONCAT('test1', Standard#CONCAT('3444', '444'));
str := Standard#CONCAT('test1', _3S_License.Standard#CONCAT('3444', '444'));
str := Standard#CONCAT('test1', _3S_License#Standard#CONCAT('3444', '444'));
str := Standard#CONCAT('test1', _3S_License#Standard#CONCAT('asdf', 'fdas'));