ILibrary and LibraryBase

Using the PLCnext CLI (see PLCnCLI )the Eclipse® add-in or the Visual Studio® extension creates the meta configuration files (libmeta, compmeta, progmeta) required for PLCnext Engineer as well as the following functions with a functional implementation during compiling. If you have special requirements that go beyond this, the following descriptions will help you understand the functions.

In a shared object (*.so), there can be exactly one library class (singleton pattern). The PLCnext Technology firmware initializes the *.so after it has been loaded by calling the following function:

extern "C" ARP_CXX_SYMBOL_EXPORT ILibrary& ArpDynamicLibraryMain(AppDomain& appDomain);

This function is implemented in such a way that the library class is created and returned as an interface. The library object implements the ILibrary interface by means of derivation from the LibraryBase class. ILibrary is defined in header Arp/System/Acf/ILibrary.hpp, and LibraryBase in Arp/System/Acf/LibraryBase.hpp. The LibraryBase class especially implements a ComponentFactory with the IComponentFactory interface.

The PLCnext Technology firmware can thus create instances of the components when loading the PLC program. In order for the PLCnext Technology firmware to be able to determine the necessary information (names of components and program types, program ports), the library class also has to implement the IMetaLibrary interface (#include "Arp/Plc/Commons/Meta/IMetaLibrary.hpp").

This interface then requires the implementation of the ITypeInfoProvider interface (#include "Arp/Plc/Commons/Meta/TypeInfoProvider.hpp"), whereby the firmware learns the names of the components and program types as well as their IN and OUT ports.

The MetaLibraryBase (#include "Arp/Plc/Commons/Meta/MetaLibraryBase.hpp") therefore expands the LibraryBase class by these interfaces.

The component instances the PLCnext Technology firmware creates are defined in the *.acf.config and *.plm.config files.

AppDomain and IApplication

If you use the Eclipse® add-in, the required header files are included automatically.

  • AppDomain: Arp/System/Core/AppDomain.hpp
  • IApplication: Arp/System/Acf/IApplication.hpp

The PLCnext Technology firmware is distributed among several operating system processes.

AppDomain

An AppDomain represents such an operating system process. If a library is to be used in several processes, singleton implementation is performed for each process. The AppDomain class is used for this. Since the PLCnext Technology firmware uses the same mechanism for instantiation, initialization and administration of user components as it does for core components, the AppDomain is also used here.

IApplication

The operating system process is represented by the IApplication interface.

 

 

 


•  Web browser recommendation: Chrome/Edge 88 or newer, Firefox ESR 90 or neweror Safari • 
• Published/reviewed: 2022-09-14 • Revision 046 •