ILE C/C++ Programmer's Guide


Renaming Programs and Procedures

You might want to rename a program or procedure (function) for the following reasons:

You can use the #pragma map directive to map an internal identifier to an OS/400-compliant name (10 characters or less for program names and one or more characters for ILE procedure names) in your program.

Note:
For the syntax and description, see WebSphere Development Studio: ILE C/C++ Compiler Reference.

The #pragma map directive can appear anywhere in the source file within a single compilation unit. It can appear before any declaration or definition of the named object, function or operator. The identifiers appearing in the directive, including any type names used in the prototype argument list, are resolved as though the directive had appeared at file scope, independent of its actual point of occurrence.

As an example, see Figure 197. In this code, there are two functions named func(). One is a regular function, prototyped int func(int) and the other is a class member function void func(void). To avoid confusion, they are renamed funcname1, and funcname2 using the #pragma map directive.

Figure 197. Example of Using the #pragma map Directive to Rename Functions



int func(int);

class X
{
public:
void func(void);
#pragma map(func, "funcname1") //maps ::func
#pragma map(X::func, "funcname2") //maps X::func
};

Note:
Mapping can be based on parameter type as well as scope. For example, void func(int); void func(char); #pragma map(func(int),"intFunc") #pragma map(func(char), "charFunc"). This does not work with the *PRV option.


[ Top of Page | Previous Page | Next Page | Table of Contents ]