H2INC Produces Garbage/GP Faults with Some Function Typedefs

ID Number: Q72853

6.00 | 6.00

MS-DOS | OS/2

Summary:

Under some 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 DOS, the result may be

garbage characters in the generated .INC file. Under OS/2, H2INC may

cause a general protection violation (GP Fault).

This problem may occur with C header files of various configurations.

In most cases, adding a dummy typedef to the header file will solve

the problem.

More Information:

The sample header file below may be used to illustrate this problem.

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

are true:

1. Two consecutive typedefs in the file are used to define functions.

2. The total argument count for the two typedefs is 10 or more.

3. The last argument to the first function typedef is a far pointer.

To work around this behavior, define a dummy typedef between the two

typedefs that will keep the argument count below 10. This is also

shown in the sample code below.

Microsoft has confirmed this to be a problem in H2INC version 1.00

(buglist1.00). We are researching this problem and will post new

information here as it becomes available.

Sample Code

-----------

/* 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;