Several component types in the same library

Using the PLCnext CLI or the Eclipse® Add-in creates the metadata 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.

Initially, the Eclipse® Add-in creates exactly one component type in a library. If several component types are to be instantiated in the same library, each component type has to be added to the factory. To this end, every component type is introduced to the factory by calling the AddFactoryMethod() function in the constructor of the library object. The PLCnext CLI generates the required code if the //#component directive is prefixed in the header of the class definition:

class SampleComponent : public ComponentBase,

There may be several components in a library, but they must all be either a "Function Extension" (based on the ACF) or a "User Program" (based on the PLM). Mixing is not possible.

There are two ways to instantiate components:

  • "Function Extensions", managed by the ACF, are instantiated through the *.acf.config file (find it in /opt/plcnext/projects/Default/*.acf.config).
  • "User Programs", managed by the PLM, are instantiated through the *.plm.config file (find it in /opt/plcnext/projects/Default/Plc/Plm/*.plm.config).
    When used as PLCnext Engineer library, this is performed automatically by PLCnext Engineer, but it can also be done manually.




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