I'm trying to implement retrieving Retain variables from File, using lib cmpApp. I found a sample in Codesys Store:http://store.codesys.com/application-manager.html
So I copied PRG into my project added lib and retain variable, And I get an error that RTS_IEC_RESULT is unknown type, but is declared like:
fbDelete : FILE.Delete; (* Function block to delete the file *)
(* The retain file <application-name>.ret is placed in the directory of the bootproject *)
sFileName : STRING := 'App1.ret';
pApp : POINTER TO APPLICATION;
Result : RTS_IEC_RESULT; (* Result code *)
xInit : BOOL;
(* The retain variables are stores in a file and get retrieved afterwards. *)I have no Idea how to declare it other way??? Any Ideas?
IF NOT xInit THEN
(* First delete the retain file.
This is necessary, because the function AppStoreRetainsInFile appends the data at the end of the file. *)
IF fbDelete.xDone OR (fbDelete.xError AND fbDelete.eError = FILE.ERROR.NOT_EXIST) THEN
(* Attention: It takes at least one cycle until xDone is TRUE *)
xInit := TRUE;
(* Now, it's the time to save the retains. *)
pApp := AppGetCurrent(pResult:=ADR(Result));
IF pApp <> 0 THEN
(* Store the variables in a file*)
Result := AppStoreRetainsInFile(pApp,sFileName);
(* Restore the Retain Variables from the file.
For storing and restoring, the same pointer to application (pApp) must be used.*)
Result := AppRestoreRetainsFromFile(pApp, sFileName);