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

Questions about CheckPointer Function

Anonymous
2011-07-20
3 days ago
  • Anonymous - 2011-07-20

    Originally created by: Captive Engineer

    Hello.

    I am struggling to understand the CheckPointer function in CoDeSys. The help file says that if I include a function that is exactly named "CheckPointer", the function shall "be called automatically before each access on the address of a pointer." This statement suggests that I do not have to make an explicit call to the function, but if I don't call the function, I do not understand how to obtain the result of the implicit function call. So I start with two questions:

    1) How do I obtain the DWORD result of the CheckPointer function call?
    2) What is the result indication for a valid memory versus an invalid memory location?

    The function declaration looks like this:

    FUNCTION CheckPointer : DWORD
    VAR_INPUT
       dwAddress   :   DWORD;
       iSize      :   DINT;
       bWrite      :   BOOL;
    END_VAR
    

    I am using a 32-bit system.

    This brings me to my third question. The help file does not indicate any code for the CheckPointer function, just its interface declaration.

    3) Do I need to add any code into the actual CheckPointer function?

    If the answer to question #3 is that no code needs to be added, then how is the CheckPointer function actually testing anything?

    Finally, is there any example code that illustrates the proper use of this CheckPointer function? The help file does not seem to go any further than describing the input interface, but this is no illustration of how to use it.

    Thank you for whatever explanations you can provide.

    Kind regards,
    The Captive Engineer

     
  • winy kakani - 2022-05-20

    Hi,

    Even i am stuck at same problem.
    Request codesys to provide a good explaination of "checkpointer" function, similar to one shown for "CheckBounds" function.
    Early help shall be appreciated.

    Regards,
    Winy Kakani

     
  • hermsen

    hermsen - 2022-05-20

    The reason behind a stub implemented for CheckPointer is that depends on what exactly the function should check for you. Since this can widely differ a single implementation cannot be given. In other words because there are so much possibilities for usage, a single implementation is not possible.

    The programmer should think about what the checkpointer functionality should check/do and provide an implementation accordingly.

     

Log in to post a comment.