SW500011 Microchip Technology, SW500011 Datasheet - Page 106

HI-TECH X PRO FOR PIC32

SW500011

Manufacturer Part Number
SW500011
Description
HI-TECH X PRO FOR PIC32
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC32r
Datasheet

Specifications of SW500011

No. Of User Licenses
1
Supported Families
PIC32
Core Architecture
PIC
Supported Hosts
Windows XP, Vista, Linux, Mac OS X
Software Edition
Professional
Kit Contents
Software And Docs
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC32 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
032
778-1007
778-1007
Linking Programs
MCU Family is only 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.
106
At link time the linker will report any mismatch of signatures. HI-TECH C PRO for the PIC32
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 PICC32 -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)
{
}
and compile it to assembly code using
PICC32 -S x.c
The resultant assembly code includes the following line:
SIGNAT _widget,8249
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:
extern char widget(long);
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.
UT RIAL
C Language Features

Related parts for SW500011