Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Extending a library function in an application and getting Interface conversion errors

jtebokkel
2020-06-03
2020-06-03
  • jtebokkel

    jtebokkel - 2020-06-03

    I have an issue where I have extended a function block from a library, but when I try to use it with the library defined interfaces I get the attached error.

    Error Text

    [ERROR]         PRS Alternator Test: gAlarmManager(Line 5): C0032:  Cannot convert type 'PceAlarms.IAlarmManager(pcealarms, 0.0.0.1 (powercore engineering))' to type 'IAlarmManager'
    

    Base FB Declaration in Library

    FUNCTION_BLOCK AlarmElement IMPLEMENTS IAlarmElement, PCI2.IBasicLogger
    ...
    

    Extended FB Declaration in Project

    FUNCTION_BLOCK PceAlarm EXTENDS PceAlarms.AlarmElement
    ...
    

    GVL in Project

    VAR_GLOBAL
        fbManager : PceAlarms.AlarmManager;
        Manager : PceAlarms.IAlarmManager := fbManager;
    ae000 : PceAlarm(AlarmManager:=Manager, alarm:=gAlarm.xwNULL, ....
    

    How is the interface different when imported from a library vs being used inside the library? Am I doing something wrong? Should I organize the code a different way? Interfaces in their own library?

     
  • aliazzz

    aliazzz - 2020-06-03

    Send us a .projectarchive so we can check.

     

Log in to post a comment.