Max Identifier Length May Cause C/MASM Mixed-Language Conflict

ID Number: Q70249

5.10 5.10a | 5.10 5.10a

MS-DOS | OS/2

Summary:

The Microsoft Macro Assembler (MASM) versions 5.10 and 5.10a allow

identifiers to have a length of 31 characters. The Microsoft C

Compiler versions 5.10, 6.00, and 6.00a 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.00. Identifiers may be up to

247 characters long with version 6.00.