Looking for thoughts on creating libraries that can be used on both 32-bit and 64-bit controllers. We are currently writing software in CoDeSys for both target types and will continu to do so for the near future. Projects are always unique, no straight forward copy/paste, yet there is enough similarity between them to use libraries for recurring logic. I do not want to create and maintain twice for both platforms if this is not absolutely necessary.
I am aware of useful datatypes like __XWORD, __XINT, __UXINT. Still looking for more information and/or sample code for portable pointer arithmetic. In addition to that: how should one go about when creating and working with compiled libraries? Would I need to compile the same lib twice, once for 32-bit targets once for 64-bit targets? I would end up with two different libs with the same namespace, which does not sound elegant to me.
Note: I did not intentionally make the previous paragraph bold. The forge forum software seems to do this automatically upon insertion of a word which starts with two underscores, e.g. __XWORD (yeah, here we go again :) )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Tim. I would think it somehow is relevant when creating a compiled library, but that may very well not be the case. If I understand you correctly, then the same compiled library created from my source code would work for both 32 bit as well as 64 bit controllers.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Follow up question: in the Project Settings, under Library Development, there is an option related to this:
Check all Pool Objects -> Pointer size to use
Options are:
* 32 Bit
* 64 Bit
* 32 and 64 Bit
The descriptions and online help suggest to me this is only relevant for checking and showing any incorrect pointer types as an error in the IDE. E.g. using a DWORD to store a pointer value on a 64-bit controller. It would not control the creation of either 32-bit or 64-bit compiled libraries. Is that correct?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It helps you to find errors in the source code of your library if you want to create a library which is using pointers and you want to use your library on 32 and/or 64 bit platforms.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looking for thoughts on creating libraries that can be used on both 32-bit and 64-bit controllers. We are currently writing software in CoDeSys for both target types and will continu to do so for the near future. Projects are always unique, no straight forward copy/paste, yet there is enough similarity between them to use libraries for recurring logic. I do not want to create and maintain twice for both platforms if this is not absolutely necessary.
I am aware of useful datatypes like __XWORD, __XINT, __UXINT. Still looking for more information and/or sample code for portable pointer arithmetic. In addition to that: how should one go about when creating and working with compiled libraries? Would I need to compile the same lib twice, once for 32-bit targets once for 64-bit targets? I would end up with two different libs with the same namespace, which does not sound elegant to me.
Note: I did not intentionally make the previous paragraph bold. The forge forum software seems to do this automatically upon insertion of a word which starts with two underscores, e.g. __XWORD (yeah, here we go again :) )
You don't have to create 2 libraries. CODESYS will handle it automatically based on the selected device in your application.
Thanks Tim. I would think it somehow is relevant when creating a compiled library, but that may very well not be the case. If I understand you correctly, then the same compiled library created from my source code would work for both 32 bit as well as 64 bit controllers.
Follow up question: in the Project Settings, under Library Development, there is an option related to this:
Check all Pool Objects -> Pointer size to use
Options are:
* 32 Bit
* 64 Bit
* 32 and 64 Bit
The descriptions and online help suggest to me this is only relevant for checking and showing any incorrect pointer types as an error in the IDE. E.g. using a DWORD to store a pointer value on a 64-bit controller. It would not control the creation of either 32-bit or 64-bit compiled libraries. Is that correct?
Yes, you are right. I think the help is pretty clear:
https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_library_development.html
It helps you to find errors in the source code of your library if you want to create a library which is using pointers and you want to use your library on 32 and/or 64 bit platforms.