A question:
In the Project Information dialog (under POUs) I tick the box: 'Automatically generate POUs for property access'.
Now in my program I can read the version of the program with this line:
When I compile the program I get the following error message:
Zitat:
ambigous use of name 'GetVersion'
This is because the function GetVersion is also declared in 2 libraries.
I can use the GetVersion functions of the libraries by using the library namespace like so:
VersionNumber := SM3_Basic.GetVersion();
But how do I use the GetVersion function of my project?
Thanks,
Stefan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As you can see in the "Project Information - Summary" dialog, the fields in bold letters are used to identify a library.
When you create your own library you can put the objects in the POU pool which are part of your library.
Because of the introduction of library versioning in V3 you need to fill in these fields (mandatory).
In the library you can add your own namespace to identify the specific getversion function (no ambiguous use) in the project.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I couldn't resist to find out how it can be done. I used CoDeSys V3.5 SP1 P2 with the Control Win.
- Right click on the "Application" and choose Properties
- Go to the Tab "Information"
- Here you can fill in your version number
When you download your application, also this information is loaded in the PLC. I noticed it is not changed when doing online changes.
To access this information from your application you need to add the Library CmpApp. This is not documented, but it works with the code you can find below:
VARÂ Â sVersion:STRING;Â Â pApp:POINTERTOCmpApp.APPLICATION;Â Â prInfo:POINTERTOCmpApp.Application_INFO;Â Â pResAGAI:POINTERTOCmpApp.SysTypes.RTS_IEC_RESULT;Â Â pResAGC:POINTERTOCmpApp.SysTypes.RTS_IEC_RESULT;END_VAR
Updated Function to get all application information from the Application
 FUNCTIONGetAppInfo:BOOL(*'******************************************************************************'*ThisFunctiongetstheapplicationinformation.'*'*FunctionrequiresthesystemlibraryCmpApp'* '********************************************************************************)VAR_OUTPUT  strProjectName:STRING(255);  strDescription:STRING(255);  strProfile:STRING(255);  strVersion:STRING(255);  strLastChanges:STRING(255);END_VARVAR  tResult:DWORD;  tFirstApp:POINTERTOAPPLICATION;  pAppInfo:POINTERTOAPPLICATION_INFO;  pString:POINTERTOSTRING;END_VAR
tFirstApp :=AppGetFirstApp(pResult :=tResult);IFtFirstApp<>0THEN
  pAppInfo :=AppGetApplicationInfo(tFirstApp, tResult);
  strProjectName :=pAppInfo^.pstProjectName^;
  strDescription:=pAppInfo^.pstDescription^;
  strProfile:=pAppInfo^.pstProfile^;
  strVersion:=pAppInfo^.pstVersion^;
  strLastChanges:=DT_TO_STRING(pAppInfo^.dtLastChanges);END_IF
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is the example of using the 'AppGetProjectInformation' and 'AppGetApplicationInfo'.
VARÂ Â pApp:POINTERTOAPPLICATION;Â Â pAppInfo:POINTERTOAPPLICATION_INFO;Â Â pProInfo:PROJECT_INFO;Â Â pResAppInfo:RTS_IEC_RESULT;Â Â pResCur:RTS_IEC_RESULT;Â Â pResProInfo:RTS_IEC_RESULT;END_VAR
Hi all,
A question:
In the Project Information dialog (under POUs) I tick the box: 'Automatically generate POUs for property access'.
Now in my program I can read the version of the program with this line:
When I compile the program I get the following error message:
This is because the function GetVersion is also declared in 2 libraries.
I can use the GetVersion functions of the libraries by using the library namespace like so:
VersionNumber := SM3_Basic.GetVersion();
But how do I use the GetVersion function of my project?
Thanks,
Stefan
As you can see in the "Project Information - Summary" dialog, the fields in bold letters are used to identify a library.
When you create your own library you can put the objects in the POU pool which are part of your library.
Because of the introduction of library versioning in V3 you need to fill in these fields (mandatory).
In the library you can add your own namespace to identify the specific getversion function (no ambiguous use) in the project.
I couldn't resist to find out how it can be done. I used CoDeSys V3.5 SP1 P2 with the Control Win.
- Right click on the "Application" and choose Properties
- Go to the Tab "Information"
- Here you can fill in your version number
When you download your application, also this information is loaded in the PLC. I noticed it is not changed when doing online changes.
To access this information from your application you need to add the Library CmpApp. This is not documented, but it works with the code you can find below:
I have tried your code, and it works well.
Thank you!
Updated Function to get all application information from the Application
thank you! works for me.
thank you! works for me.
Here is the example of using the 'AppGetProjectInformation' and 'AppGetApplicationInfo'.