Converts all references to an identifier to another, externally defined identifier.
name1 should be declared in the same compilation unit in which it is referenced, but should not be defined in any other compilation unit. name1 must not be used in another #pragma map directive or any assembly label declaration anywhere in the program.
If the name exceeds 65535 bytes, an informational message is emitted and the pragma is ignored.
name2 may or may not be declared in the same compilation unit in which name1 is referenced, but must not be defined in the same compilation unit. Also, name2 should not be referenced anywhere in the compilation unit where name1 is referenced. name2 must not be the same as that used in another #pragma map directive or any assembly label declaration in the same compilation unit.
The #pragma map directive can appear anywhere in the program. Note that in order for a function to be actually mapped, the map target function (name2) must have a definition available at link time (from another compilation unit), and the map source function (name1) must be called in your program.
You cannot use #pragma map with compiler built-in functions.
/* Compilation unit 1: */
#include <stdio.h>
void foo();
extern void bar(); /* optional */
#pragma map (foo, "bar")
int main()
{
foo();
}
/* Compilation unit 2: */
#include <stdio.h>
void bar()
{
printf("Hello from foo bar!\n");
}
The call to foo in compilation
unit 1 resolves to a call to bar: Hello from foo bar!