BUG: H2INC Produces Garbage/GP Faults w/ Some Function Typedefs (72853)



The information in this article applies to:

  • Microsoft Macro Assembler (MASM) 1.0

This article was previously published under Q72853

SYMPTOMS

Under certain circumstances, the Microsoft C to MASM Include File Translator (H2INC) version 1.0 that ships with the Microsoft Macro Assembler (MASM) version 6.0 may generate invalid results for certain C include files with function typedefs. Under MS-DOS, the result may be garbage characters in the generated .INC file. Under OS/2, H2INC may cause a general protection violation (GP Fault).

The problem occurs in this file only when all the following conditions are true:

  • Two consecutive typedefs in the file are used to define functions.
  • The total argument count for the two typedefs is 10 or more.
  • The last argument to the first function typedef is a far pointer.

RESOLUTION

To work around this behavior, define a dummy typedef between the two typedefs that will keep the argument count below 10.

STATUS

Microsoft has confirmed this to be a problem in H2INC version 1.0 which is included with MASM version 6.0. This problem was corrected in H2INC version 1.0 which is included with MASM version 6.0a.

MORE INFORMATION

The sample header file below may be used to illustrate this problem. Garbage characters will appear in the resulting .INC file.

Sample Code

/* Command line options needed: none
*/ 
typedef void Func1Def(int, int, int, int, void _far *);
// typedef void DummyFunc(int, int, int);  // Uncomment for workaround
typedef void Func2Def(int, int, int, int, int);

struct FuncStruct
{
   int arg1;
   Func1Def * Func1;
   Func2Def * Func2;
} FuncStruct;
				

Modification Type:MajorLast Reviewed:7/27/2001
Keywords:KB72853