Attribute 'c++_compatible'

The pragma causes the VTable generated by the PLC compiler to be binary compatible with that of a C++ compiler. This makes it possible to access the interface methods implemented in the PLC from a TcCom module implemented in C++.

Syntax: {attribute 'c++_compatible'}

Insertion location:

The pragma must be added in the following places:

Sample:

Declaration of a function block that implements a C++-compatible interface:

{attribute 'c++_compatible'}
FUNCTION_BLOCK FB_Sample IMPLEMENTS I_Sample
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
END_VAR

Declaration of a method that is defined in the interface:

{attribute 'c++_compatible'}
{attribute 'minimal_input_size' := '4'}
{attribute 'pack_mode' := '4'}
METHOD Method1 : HRESULT
VAR_INPUT
    nParameter1 : INT; 
END_VAR

See also: