Declaration of the contents of the library

Syntax
LIBRARY fully.qualified.name
...
FOLDER "name1" (* a folder to be included in the library *)
(* 'IEC' specifies an element to be included in the above-specified folder. Some of its values are invalid for library type 'LOGIWEB' and 'LOGISAFE', others for 'LOGICAD'. *)
IEC := fully.qualified.name1|POU-name1; (* optional_begin *), DEPLOY:=SOURCE|INTERFACE|OBJECT, VISIBILITY:=PUBLIC|PRIVATE, SiLCoverageReviewed:="<FINGERPRINT>", "Comment on reviewed coverage" (* optional_end *);
IEC := fully.qualified.name2|POU-name2;
...
(* 'FILE' specifies an additional file to be included in the above-specified folder. *)
FILE := "path\name1"; (* Note: Paths can be entered by using: \ or / *)
FILE := "path\name2" (* optional_begin *), SOURCEPATH := "path" (* optional_end *);
...
FOLDER "name2" (* a sub-folder to be included in the library *)
IEC := fully.qualified.name3|POU-name3; (* 'IEC' and 'FILE' statements can be used as specified above. *)
FILE := "path/name3" (* optional_begin *), SOURCEPATH := "path" (* optional_end *);
...
END_FOLDER
... (* additional folders and/or sub-folders with 'IEC' and 'FILE' statements as needed *)
END_FOLDER
 
(* optional statements for 'LOGICAD', invalid for library type 'LOGIWEB' and 'LOGISAFE'. *)
BINARY_LIBRARIES FOR platform-name
FILE:= "path\name4";
FILE:= "path\name5" (* optional_begin *), SOURCEPATH := "path" (* optional_end *);
...
END_BINARY_LIBRARIES
BINARY_OBJECTS FOR BuiltInPlc
FILE := "path\name6";
FILE := "path\name7" (* optional_begin *), SOURCEPATH := "path" (* optional_end *);
...
END_BINARY_OBJECTS
INCLUDES (* optional_begin *) FOR platform-name (* optional_end *)
FILE:= "path\name8";
FILE:= "path\name9" (* optional_begin *), SOURCEPATH := "path" (* optional_end *);
...
END_INCLUDES
SOURCES (* optional_begin *) FOR platform-name (* optional_end *)
FILE:= "path\name10";
FILE:= "path\name11" (* optional_begin *), SOURCEPATH := "path" (* optional_end *);
...
END_SOURCES
END_LIBRARY

Meaning

declaration of the contents for a →library
The declarations are possible within a library configuration, in particular within LIBRARY and END_LIBRARY. See "Declaration of information on creation and references for the library" for the possibilities before FOLDER.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg Depending on the library type (see under "Creating and deploying a custom library" for details on the library type), you might not be able to use certain sections/elements of the following ones. See "Peculiarities for logi.SAFE/logi.WEB libraries" which statements are required for a logi.SAFE and a logi.WEB library and which must not be used.The contents of the library results from the following sections/elements:

Section/element

Explanation

FOLDER "name"
...
END_FOLDER

a folder in the library, name must be a valid name for the path in the operating system
Example for Windows: Special characters, such as * or >, must be avoided.

Specify a section FOLDER ... END_FOLDER for each required folder in the library. The folders are created in the sub-folder FOLDER of the library.
If sub-folders are required, specify a section FOLDER ... END_FOLDER within another section FOLDER ... END_FOLDER (see FOLDER "Testing" ... END_FOLDER in the following example 1).

Note: It is possible to skip the part "name" for the first FOLDER ... END_FOLDER. Result: The files for all statements specified in this first section FOLDER ... END_FOLDER will be copied directly into the sub-folder FOLDER of the library (see the following example 2).

IEC := fully.qualified.name|POU-name
(* optional_begin *), DEPLOY:=SOURCE|INTERFACE|OBJECT,
VISIBILITY:=PUBLIC|PRIVATE, SiLCoverageReviewed:="<FINGERPRINT>", "Comment on reviewed coverage"
(* optional_end *);

the library element in the library; This library element is either a →POU, a →data type or an →interface. (A →method must not be specified after IEC := . But as alternative, you may specify the function block in which the method is declared – but for this function block, use only DEPLOY:=SOURCE ).

In case of a logi.SAFE or logi.WEB library, there are specific requirements for the library element; See under "Peculiarities for logi.SAFE/logi.WEB libraries".

The name to be specified for the element depends whether you have used a →namespace when creating the element:

  • If yes (as recommended by logi.cals), enter the fully qualified name. This is done as described under: "Namespaces in ST: usage"
    Example: com.CompanyA.Controller.Motor1 – with the Motor1 block declared in the nested namespace com.CompanyA.Controller

  • If no, just enter the name of the POU.
    Example: Counter for the function block Control

Specify a statement IEC := ... for each required element in the library. This statement is possible within a section FOLDER ... END_FOLDER.
Restriction: A
→program with →global variables must not be specified .

The optional keyword DEPLOY defines the format for the element how to copy the statements of the element into the library. All 3 values are supported for a logi.CAD 3 library.

  • SOURCE – This value copies all statements of the element into the library. SOURCE is the default value and is applied without a specified keyword DEPLOY.
    Only this value is possible for a →program , a function block with →methods, an →interface, a logi.SAFE orlogi.WEB library.

  • INTERFACE – This value copies only the interface-relevant statements into the library and the assignments within the element – hence the actual source (the actual code or logic) – are not visible directly within the library elements . The required binary code for the element is created when the library element is used.
    Mind the following effects:

    • If you specify an FBD-POU or an LD-POU with the value INTERFACE, logi.CAD 3 generates an ST-object (= a file with file extension .iecst instead of a file with the original file extension, such as .iecfbd) to be included in the library. Subsequently, the ST-editor (instead of the FBD-/LD-object) will be opened for the library element within the deployed library. You may rest assured that this change will not affect the usage of the element generated for the library.
      Depending on the way how you generate the library, the library might contain the sources within a password-protected library.

    • The specified element must not contain →external variables.

  • OBJECT – as for INTERFACE but with this difference: The required binary code for the element is created when the library element is generated. Use this value in order to protect the contents of the element from third-parties (= know-how protection) because only the interface of the element is provided as plain text. The actual code or logic will not be deployed together with the library as plain text.
    Mind the following effects:

    • as for INTERFACE – An FBD-/LD-POU becomes an ST-object within the library. Its sources might be included in a password-protected library as well.

    • as for INTERFACE – The specified element must not contain external variables.

    • The library configuration must use the statement SUPPORTED_PTKS:=platform name as well. Subsequently, the deployed library is only valid for applications with the specified platforms. See "Declaration of information on creation and references for the library" for details on this statement.

    • The specified element must not contain →external variables.

The optional keyword VISIBILITY defines the visibility of the element the library. These values are supported:

  • PUBLIC – This value makes the element to a public library element that is visible within the library without restriction. PUBLIC is the default value and is applied without specified keyword VISIBILITY.

  • PRIVATE – This value makes the element to a private library element that is included within the library but it is not visible within logi.CAD 3 by default (in particular within the graphical user interface of logi.CAD 3) .
    Usually, such private library elements are auxiliary functionalities that are used in public library elements. The auxiliary functionalities must be included within the library so that the other library elements work properly. However, it should not be possible to use the auxiliary functionalities directly within the application.

The optional keyword SiLCoverageReviewed defines that the library element must not achieve a full test coverage for logi.SAFE or logi.WEB libraries. The following values are required as well:

  • "<FINGERPRINT>" – Enter the →fingerprint of the library element. You find the fingerprint within the library generation report that is created when the library is generated. Best practice is to search within this HTML-file for the name of the library element and to copy its fingerprint to the clipboard. Afterwards paste the fingerprint after SiLCoverageReviewed.

  • "Comment on reviewed coverage" – Enter a meaningful comment why a deviation from the full test coverage is justified.

Notes on the statement IEC:

  • The specified element must be existing in the project so that the library can be generated.

  • If the specified element is using other elements (such as POUs or data types), those elements will not automatically be copied into the library. That means you must specify all used elements by the statements IEC := ... as well.

  • The library contains the file in which the specified element has been declared. Example: If the element Motor1 has been declared in the file MyPOU1.iecst, the library contains the file MyPOU1.iecst.

  • If several elements have been declared in one ST-object, logi.CAD 3 uses only the content as required for the appropriate element.

FILE := "path/name" (* optional_begin *), SOURCEPATH := "path" (* optional_end *;

an additional file in the library, path and name must be a valid name for the path or the file name in the operating system
Example for Windows: Special characters, such as * or >, must be avoided.

Specify a statement FILE := ... for each required file in the library. This statement is possible within the following sections: FOLDER ... END_FOLDER , BINARY_LIBRARIES ... END_BINARY_LIBRARIES, BINARY_OBJECTS ... END_BINARY_OBJECTS, INCLUDES ... END_INCLUDES and SOURCES ... END_SOURCES

Notes:

  • The specified file must be existing in the project so that the library can be generated.

  • Enter the path relative to the project.

  • The file is filed using the specified path within the library.

The optional keyword SOURCEPATH defines an additional path in which the file is searched within the current project . However, this path is not considered for filing the file within the library. See examples with SOURCEPATH for details.

BINARY_LIBRARIES FOR platform-name
FILE := ...
END_BINARY_LIBRARIES
BINARY_OBJECTS FOR platform-name
FILE := ...
END_BINARY_OBJECTS

binaries for the logi.CAD 3 library, in particular C-libraries (.lib) and object files (*.o or *.obj) that must be linked during the linking process of the application as well
Instead of the attribute platform-name, you must specify one of the platforms provided in logi.CAD 3. The available platforms are listed under "Configuring PLC within PLC-object".
Specify the sections BINARIES_LIBRARIES ... END_BINARY_LIBRARIES and BINARY_OBJECTS ... END_BINARY_OBJECTS for each platform for which the binaries are required. Specify the files by the appropriate statements FILE := ... (see above for the syntax).

The files are copied into the sub-folder BINARY_LIBRARIES\platform-name.PTK or BINARY_OBJECTS\platform-name.PTK of the library.

Note: The specified files are not checked by logi.CAD 3 when the library is generated (for example if wrong binaries or text files are specified). That means, that errors regarding these files will only be reported when you create the application that is using e.g. elements from the library.

INCLUDES (* optional_begin *) FOR platform-name (* optional_end *)
FILE := ...
END_INCLUDES

includes for the logi.CAD 3 library, in particular header files (*.h) that must be found during the compile process (hence, the files must be integrated into the Include path) w hen building the application that is using elements of the created/installed library

It is possible to specify several sections INCLUDES ... END_INCLUDES. Specify the header files by the appropriate statements FILE := ... (see above for the syntax).
The files are copied into the sub-folder INCLUDES or INCLUDES\platform-name.PTK of the library.
Instead of the attribute platform-name (within the optional part FOR platform-name), you are able to specify one of the platforms provided in logi.CAD 3. In this case, the i ncludes are found when building the application for the PLC for which the same platform is specified. The includes are not found for a PLC for which a different platform is specified, i.e. it is not possible to build the application for such a PLC.
If you want to support the library with the same includes for different PLC with different platforms, best practice is to specify just one section omitting the platform name (incl. the keyword FOR).

Note: The specified files are not checked by logi.CAD 3 when the library is generated. The files are only integrated into the search path for the include files. That means, that errors regarding these files will only be reported when you create the application that is using e.g. element s from the library.

Explanation using some examples how the optional keyword SOURCEPATH effects the statement FILE := ... within the section INCLUDES FOR platform-name ... END_INCLUDES :

  • Example 1, statement FILE := "sys/GlobalIncludes1.h", SOURCEPATH := "src/h";: The file GlobalIncludes1.h is searched for in the sub-folder src/h/sys of the project. It is copied into the folder INCLUDES\platform-name\sys of the library.
    Consequence: If you want to use this H-file for a C-block within a project in which the library is installed, the include statement must be done with: sys/GlobalIncludes1.h

  • Example 2, statement FILE := "GlobalIncludes2.h", SOURCEPATH := "src/h";: The file GlobalIncludes2.h is searched for in the sub-folder src/h of the project. It is copied into the folder INCLUDES\platform-name of the library.
    Consequence: If you want to use this H-file for a C-block within a project in which the library is installed, the include statement must be done with: GlobalIncludes2.h

Notes on both examples: If you want to use the H-file for a C-block within the project in which the library is generated, you have to define this file within the settings for C-blocks. The following include path would be necessary for both examples: ${PROJECT_LOC}\src\hHowever, if you do not use SOURCEPATH := ..., the following include path would be necessary: ${PROJECT_LOC}

SOURCES (* optional_begin *) FOR platform-name (* optional_end *)
FILE := ...
END_SOURCES

source files for the logi.CAD 3 library, in particular C-files (*.c) or C++-files(*.cpp) that must be compiled and linked during the compile process w hen building the application that is using elements of the created/installed library

It is possible to specify several sections SOURCES ... END_SOURCES. Specify the source files by the appropriate statements FILE := ... (see above for the syntax).
The files are copied into the sub-folder USER_SOURCES\GLOBAL__SOURCES\ or USER_SOURCES\platform-name.PTK of the library.
Instead of the attribute platform-name (within the optional part FOR platform-name), you are able to specify one of the platforms provided in logi.CAD 3. In this case, the source files are found when building the application for the PLC for which the same platform is specified. The source files are not found for a PLC for which a different platform is specified, i.e. it is not possible to build the application for such a PLC.
If you want to support the library with the same source files for different PLC with different platforms, best practice is to specify just one section omitting the platform name (incl. the keyword FOR).

Note: The specified files are not checked by logi.CAD 3 when the library is generated (for example if faulty C- or C++-files are specified). They are only compiled, if the corresponding element is used in the application. That means, that errors regarding these files will only be reported when you create the application that is using e.g. element s from the library.

Example 1

The following example results in a created library:

LIBRARY com.CompanyA.Controller (* The library is created with the name 'com.CompanyA.Controller__1.1.0-SNAPSHOT.zip'. *)
VERSION := 1.1.0-SNAPSHOT;
PACKAGETYPE := zip;
FOLDER "Motors" (* The library contains the folder 'Motors' and the sub-folder 'Testing'. Hence, the ZIP-file contains: FOLDER\Motors\Testing *)
IEC := com.CompanyA.Controller.Motor1; (* 'Motors" will contain the files 'com.CompanyA.Controller.Motor1' and 'com.CompanyA.Controller.Motor2'. *)
IEC := com.CompanyA.Controller.Motor2;
FILE := ".olh\com.CompanyA.Controller.Motor1.EN.html", SOURCEPATH := "src/"; (* The files for the external block help for 'Motor1' and 'Motor2' - in English. *)
FILE := ".olh\Motor1.png", SOURCEPATH := "src/";
FILE := ".olh\com.CompanyA.Controller.Motor2.EN.html", SOURCEPATH := "src/";
FILE := ".olh\Motor2.png", SOURCEPATH := "src/";
FILE := ".olh\style.css", SOURCEPATH := "src/";
FOLDER "Testing" (* 'Testing" will contain the files 'com.CompanyA.Controller.Test1' and 'com.CompanyA.Controller.Testr2'. *)
IEC := com.CompanyA.Controller.Test1;
IEC := com.CompanyA.Controller.Test2;
FILE := ".olh\com.CompanyA.Controller.Test1.EN.html", SOURCEPATH := "src/"; (* The files for the external block help for 'Test1' and 'Test2' - in English. *)
FILE := ".olh\Test1.png", SOURCEPATH := "src/";
FILE := ".olh\com.CompanyA.Controller.Test2.EN.html", SOURCEPATH := "src/";
FILE := ".olh\Test2.png", SOURCEPATH := "src/";
FILE := ".olh\style.css", SOURCEPATH := "src/";
END_FOLDER
END_FOLDER
BINARY_LIBRARIES FOR BuiltInPlc (* Moreover, the library will contain some binaries, include and source files as well. *)
FILE := "libs\mathlib.lib";
END_BINARY_LIBRARIES
BINARY_OBJECTS FOR BuiltInPlc
FILE := "libs\mathlib.o";
END_BINARY_OBJECTS
INCLUDES
FILE := "h\mathlib.h";
END_INCLUDES
SOURCES
FILE := "code.c" , SOURCEPATH := "c";
END_SOURCES
END_LIBRARY

See "Example: Creating library with blocks incl. help files", if you need more explanations on the statements for the external block help.

Example 2
LIBRARY com.MyCompany.MyLib2
...
FOLDER (* The library will contain the folder 'FOLDER' in which the elements are located. *)
IEC := com.CompanyA.Controller.Motor1;
IEC := com.CompanyA.Controller.Motor2;
END_FOLDER
...
END_LIBRARY

Example 3 illustrates the library configuration for a logi.SAFE library:

Example 3
LIBRARY com.MyCompany.MyLibSAFE
VERSION :=1.1.0;
LIBRARYTYPE:=LOGISAFE;
PTK_FOR_LIBRARY_BUILD:=SafeLibraryWindowsX86;
FOLDER "SAFE"
IEC := com.Musterfirma.Safe.Motor1;
IEC := com.Musterfirma.Safe.Motor2, SiLCoverageReviewed := "E870DD09", "defensive programming -> 70% coverage is OK";
END_FOLDER
END_LIBRARY