PCDIDE COMPILER Custom Computer Services Inc (CCS), PCDIDE COMPILER Datasheet - Page 87

PCD C-COMPILER PIC24, DSPIC

PCDIDE COMPILER

Manufacturer Part Number
PCDIDE COMPILER
Description
PCD C-COMPILER PIC24, DSPIC
Manufacturer
Custom Computer Services Inc (CCS)
Type
Compilerr
Datasheet

Specifications of PCDIDE COMPILER

For Use With/related Products
Microchip PIC24/dsPIC®
Lead Free Status / RoHS Status
Not applicable / Not applicable
Other names
429-1008
Notes
·
·
·
·
·
·
·
·
By default variables declared at the unit level (outside a function) are visible to all other units.
To make a variable private to the unit use the keyword static. Notice report.c defines the
variable report_line_number. If the definition were changed to look as the following line then
there would be a link time error since main.c attempts to use the variable.
static long report_line_number;
This same rule applies to functions. Use static to make a function local to the unit.
Should two units have a function or unit level variable with the same name an error is
generated unless one of the following is true:
The standard C libraries (like stdlib.h) are supplied with source code in the .h file. Because of
the above rule these files may be #include'd in multiple units without taking up extra ROM and
with no need to include these in the link command since they are not units.
#define's are never exported to other units. If a #define needs to be shared between units put
them in an include file that is #include'd by both units. Project wide defines in our example
could go into project.h.
It is best to have an include file like project.h that all units #include. This file should define the
chip, speed, fuses and any other compiler settings that should be the same for all units in the
project.
In this example project a #USE RS232 is in the project.h file. This creates an RS232 library in
each unit. The linker is able to determine the libraries are the same and the duplicates
removed in the final link.
Each unit has its own error file (like filter.err). When the compilations are done in a batch file it
may be useful to terminate the batch run on the first error. The +CC command line option will
cause the compiler to return a windows error code if the compilation fails. This can be tested in
the batch file like this:
·
·
·
"c:\program files\picc\ccsc" +FM +CC +EXPORT report.c
if not errorlevel 1 goto abort ...
goto end
:abort
echo COMPILE ERROR
:end
The identifier is qualified with static.
The argument list is different and two instances of the function can co-exist in the
project in accordance with the normal overload rules.
The contents of the functions are absolutely identical. In this case the CCS linker
simply deletes the duplicate function.
73

Related parts for PCDIDE COMPILER