The information in this article applies to:
SYMPTOMSAn RPC application that uses stub code generated by MIDL throws memory exceptions, causes a general protection (GP) fault, or overwrites memory in the data heap. The RPC application is using a structure or union in the IDL file. CAUSE
The /Zp (packing) option of the MIDL compiler does not affect the size of
the structure; MIDL always uses a packing of 1. However, the /Zp option of
the C compiler does increase the size of the structure. Because MIDL
assumes a packing of one, it generates code that allocates less memory
than what is actually needed.
RESOLUTIONThere are three solutions to correct this problem:
STATUSMicrosoft has confirmed this to be a problem in MIDL 2.00.0102 for the Win32 SDK. This problem has been fixed in MIDL 3.0, now shipping with Windows NT 4.0 beta SDK. MORE INFORMATION
Fully interpreted stubs (MIDL option /Oi) use another approach for
parameter marshaling, and this alternative approach does not have the
problem with the packing. The stub code produced with /Oi is slightly
slower, but for most applications the loss is negligible. If you decide to
use the /Oi option, make sure your remote procedures are declared as
__stdcall. Refer to the MIDL documentation for more information on /Oi.
Another alternative is to wrap the stub code generated by MIDL with
Each time MIDL generates the stub code, you must insert #pragma pack
statements into the server stub.
For example:
Additional query words:
Keywords : kbnetwork kbAPI kbNTOS310bug kbNTOS350bug kbNTOS351bug kbRPC kbSDKPlatform kbWinOS95bug kbGrpNet |
Last Reviewed: October 14, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |