SW500010 Microchip Technology, SW500010 Datasheet - Page 115

HI-TECH C PRO FOR PIC10/12/16

SW500010

Manufacturer Part Number
SW500010
Description
HI-TECH C PRO FOR PIC10/12/16
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC10/12/16r
Datasheets

Specifications of SW500010

Supported Families
PIC10, PIC12, PIC16
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC10/12/16
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC10, PIC12, PIC14, PIC16, PIC16E
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
019P
778-1006
778-1006
C Language Features
MCU Family is only likely to issue a mismatch error from the linker when the routine is either a pre-
compiled object file or an assembly routine. Other function mismatches are reported by the code
generator.
an extern declaration. Such assembly language functions should include a signature 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 PICC -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:
Where a call to _widget is made in the C code, the signature for a function with two int ar-
guments 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:
and compile it to assembler code using
The resultant assembler code includes the following line:
The SIGNAT pseudo-op tells the assembler to include a record in the .obj file which associates the
value 8249 with symbol _widget. The value 8249 is the correct signature for a function with two
int arguments and a char return value. If this line is copied into the .as file where _widget is
defined, it will associate the correct signature with the function and the linker will be able to check
for correct argument passing. For example, if another .c file contains the declaration:
then a different signature will be generated and the linker will report a signature mis-match which
will alert you to the possible existence of incompatible calling conventions.
At link time the linker will report any mismatch of signatures. HI-TECH C PRO for the PIC10/12/16
It is sometimes necessary to write assembly language routines which are called from C using
extern char widget(int, int);
char widget(int arg1, int arg2)
{
}
PICC -S x.c
SIGNAT
extern char widget(long);
_widget,8249
Linking Programs
115

Related parts for SW500010