LINK Help (linker.hlp) (Table of Contents; Topic list)
Decorated Names
                                             Up Contents Index Back
─────LINK───────────────────────────────────────────────────────────────────
 
     Decorated Names for Functions in C++ Programs
 
     You must use a decorated name when you need to specify a C++
     function name as it is known internally by the linker.
 
     Overview
 
     Functions in C++ programs are known internally by their decorated
     names. These are created by the compiler during compilation of
     function definitions and prototypes. Some situations require the
     decorated form of a C++ function name. For example, the EXPORTS,
     IMPORTS, and FUNCTIONS statements in a .DEF file require decorated
     names for C++ functions.
 
     Format of a Decorated Name
 
     A decorated name is a string generated by the compiler. It
     contains the following information:
 
        ■ The function name.
 
        ■ The class that the function is a member of, if it is a
          member function. This may include the class that encloses
          the function's class, and so on.
 
        ■ The types of the function's parameters.
 
        ■ The calling convention.
 
        ■ The return type of the function.
 
     The function and class names are expressed literally in the
     string. The rest of the string is a code that has internal meaning
     only for the compiler and linker.
 
     Viewing Decorated Names
 
     The decorated name of a function is not generated until
     compilation. After the program is compiled, the linker uses the
     decorated form of the name. Use the LINK /MAP option to create a
     map file that shows decorated names. You can control the map
     output as follows:
 
        ■ Specify /MAP with no qualifier to get a map file that
          contains public symbols listed by name and by address. The
          map file gives the decorated form of C++ function names in
          each of these lists.
 
        ■ Specify /MAP:ADDRESS to get the same map file that /MAP
          creates but without the list of symbols sorted by name.
 
        ■ Specify /MAP:FULL to add the undecorated form of each name to
          the map file produced by /MAP. The undecorated form is given
          after the decorated name. This option also adds the
          contributions of object files to segments.
 
     To see the undecorated form of the decorated name, use /MAP:FULL.
     Note that inline functions do not generate entries in a map file.
     See: LINK /MAP Option
 
     Examples
 
          ?calc@@YAHH@Z<R>
             int __near __cdecl calc(int)
 
          ?getMonth@Date@@QACHXZ
             public: int __near __pascal Date::getMonth(void)__near
 
     These are examples of decorated names and their undecorated
     versions. The names are from the map file that is produced when
     /MAP:FULL is specified to the linker.
 
     Getting and Specifying a Decorated Name
 
     Some uses of C++ function names require that you specify the name
     in its decorated form. Decorated names are required in the
     FUNCTIONS, EXPORTS, and IMPORTS statements in a .DEF file.
 
     For example, the FUNCTIONS statement in a .DEF file accepts one or
     more names of functions that are to be placed in a specified order
     or assigned to a segment or an overlay. To assign a C++ function
     using the FUNCTIONS statement, you must give the function's
     decorated name. However, the decorated name is not known until
     after compilation. Therefore, you must use the following procedure
     to get and use decorated names in a .DEF file:
 
       1. Compile the object files for your program.
 
       2. Create a .DEF file that does not specify the C++ functions.
 
       3. Link your program using a form of the /MAP option.
 
       4. Examine the map file for the decorated names of the functions.
 
       5. Specify the decorated names in the places where you want to
          use the functions in the .DEF file.
 
       6. Relink your program.
 
     WARNING:  If you change the function name, class, calling
                   convention, any parameter, or the return type, the
                   old decorated name is no longer valid. You must
                   repeat this procedure and use the new version of the
                   decorated name everywhere it is specified.
                                    -♦-