KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q70249: Max Identifier Length May Cause Mixed C/MASM Conflict

Article: Q70249
Product(s): Microsoft Macro Assembler
Version(s): 5.1,5.1a
Operating System(s): 
Keyword(s): 
Last Modified: 06-MAY-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Macro Assembler (MASM), versions 5.1, 5.1a 
-------------------------------------------------------------------------------

SUMMARY
=======

The Microsoft Macro Assembler (MASM) versions 5.1 and 5.1a allow identifiers to
have a length of 31 characters. The Microsoft C Compiler versions 5.1, 6.0, and
6.0a also allow identifiers to have a length of up to 31 characters. However,
the C compiler adds an implied leading underscore, which may make the total
length of an identifier 32 characters.

The above limits may cause a problem when performing mixed-language programming
where a C identifier that is 31-characters long needs to be recognized by a
Macro Assembler module. The C identifier of 31 characters becomes 32 characters
because of the added leading underscore, and the assembler can only recognize 31
characters. If this occurs, a "L2029: unresolved external" error will be
generated by the linker when it does not locate a symbol with the truncated
name.

MORE INFORMATION
================

To get the assembler routine to match the C identifier of 31 characters, you can
do one of the following:

1. Use the .MODEL directive and specify the C language type. For example:

        .MODEL small,c  ; The C language type specifies C conventions

  The C language type specifies C naming and calling conventions. It will allow
  the use of a 31-character identifier and also add the implied leading
  underscore.

2. Modify the C program to shorten the length of the variable's name.

3. Update to Macro Assembler version 6.0. Identifiers may be up to 247
  characters long with version 6.0.

Additional query words: kbinf 5.10 5.10a

======================================================================
Keywords          :  
Technology        : kbMASMsearch kbAudDeveloper kbMASM510 kbMASM510a
Version           : :5.1,5.1a

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.