Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When writing code that is to be portable between OCG and non-OCG compilers how do I define absolute variables that may be used in multiple source files?

0
Posted

When writing code that is to be portable between OCG and non-OCG compilers how do I define absolute variables that may be used in multiple source files?

0

If you are using the SFR variable definitions (which are absolute variables) in the header files that come with the compilers, then there is nothing you need to do. The header files that ship with the compiler are updated to ensure they are compatible with that compiler version. If you have defined you own header files, if you have copied and modified a compiler header file, or if you simply defined absolute variables and use these variables in multiple source files, then there may be changes required if you need the same code to compiler on both OCG and non-OCG compilers. For non-OCG compilers the variables must be defined in each source file as being static, e.g. static volatile unsigned char MY_REG @ 0x30; Errors relating to the variables being defined more than once may result otherwise. For OCG compilers you can use either static, extern or no storage qualifier. This FAQ is relevant for customers migrating to, or from, an OCG-based compiler. Check the “Selected driver information

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123