Example: Matching and Renaming Symbols

The SYMBOL_SCOPE and SYMBOL_VERSION directives allow the use of MATCH and MATCHREF to match symbols by name, and optionally to rename them. The following mapfile matches all symbols starting with the letter "i" followed by an integer value, and gives them protected scope.

        $mapfile_version 2

        SYMBOL_SCOPE {
            protected:
                MATCH(r/^i[0-9]+$/);

        };

The following mapfile renames all symbols starting with the letter "i" followed by an integer value to have the prefix "interface_", and gives them protected scope.

        $mapfile_version 2

        SYMBOL_SCOPE {
            protected:
                MATCH(r/^i([0-9]+)$/)
                    { RENAME = MATCHREF(/interface_$(n1}/) };
        };