SW500007 Microchip Technology, SW500007 Datasheet - Page 96

PICC-18 PRO

SW500007

Manufacturer Part Number
SW500007
Description
PICC-18 PRO
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500007

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015P
778-1002
778-1002
Linking Programs
For example, if you wished to make changes to the library function max() which resides in the file
max.c in the SOURCES directory, you could make a copy of this source file, make the appropriate
changes and then compile and use it as follows.
The code for max() in max.c will be linked into the program rather than the max() function con-
tained in the standard libraries. Note, that if you replace an assembler module, you may need the
-P option to preprocess assembler files as the library assembler files often contain C preprocessor
directives.
3.13.2 Signature Checking
The compiler automatically produces signatures for all functions. A signature is a 16-bit value
computed from a combination of the function’s return data type, the number of its parameters and
other information affecting the calling sequence for the function. This signature is output in the
object code of any function referencing or defining the function.
likely to issue a mismatch error from the linker when the routine is either a precompiled object file
or an assembly routine. Other function mismatches are reported by the code generator.
82
At link time the linker will report any mismatch of signatures. HI-TECH PICC-18 STD is only
PICC18 --chip=18F242 main.c init.c max.c
T
It is sometimes necessary to write assembly language routines which are called from C
using an extern declaration. Such assembly language functions should include a signa-
ture which is compatible with the C prototype used to call them. The simplest method of
determining the correct signature for a function is to write a dummy C function with the
same prototype and compile it to assembly language using the PICC18 -S option. For
example, suppose you have an assembly language routine called _widget which takes
two int arguments and returns a char value. The prototype used to call this function
from C would be:
extern char widget(int, int);
Where a call to _widget is made in the C code, the signature for a function with two int
arguments and a char return value would be generated. In order to match the correct
signature the source code for widget needs to contain an assembler SIGNAT pseudo-op
which defines the same signature value. To determine the correct value, you would write
the following code:
char widget(int arg1, int arg2)
{
}
UT RIAL
C Language Features

Related parts for SW500007