FIX: MIDL Gives Warning MIDL2039 When Decimal Used as Parameter Type in IDL (232778)



The information in this article applies to:

  • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
  • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
  • Microsoft Visual C++, 32-bit Professional Edition 5.0
  • Microsoft Visual C++, 32-bit Professional Edition 6.0
  • Microsoft Visual C++, 32-bit Learning Edition 6.0

This article was previously published under Q232778

SYMPTOMS

When you compile an .idl file with decimal as the type of parameter for a method, you get an MIDL2039 warning. But it is documented that the decimal is a valid type for a parameter (for example, search the MSDN Library Index for "oleautomation").

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in Microsoft Visual C++ .NET.

MORE INFORMATION

Steps to Reproduce the Behavior


  1. Copy the following code into a new file and save it as an .idl file.
    import "oaidl.idl";
    import "ocidl.idl";
    [
    	object,
    	uuid(DE4C1D8D-C007-11D2-B978-00AA00C0018D),
    	dual,
    	helpstring("IFoo1 Interface"),
    	pointer_default(unique)
    ]
    interface IFoo1 : IDispatch
    {
    };
    
    [
    	uuid(DE4C1D80-C007-11D2-B978-00AA00C0018D),
    	version(1.0),
    	helpstring("huh 1.0 Type Library")
    ]
    library HUHLib
    {
    	importlib("stdole2.tlb");
    
    	[
    		uuid(DE4C1D8F-C007-11D2-B978-00AA00C0018D),
    		hidden,
    		helpstring("_IFoo1Events Interface")
    	]
    	dispinterface _IFoo1Events
    	{
    		properties:
    		methods:
    		[id(1), helpstring("method MIDL2039")] HRESULT MIDL2039([in] Decimal d);
    	};
    
    	[
    		uuid(DE4C1D8E-C007-11D2-B978-00AA00C0018D),
    		helpstring("Foo1 Class")
    	]
    	coclass Foo1 {
    
    		[default] interface IFoo1;
    		[default, source] dispinterface _IFoo1Events;
    	};
    };
    					
  2. Now compile it with Microsoft Interface Definition Language (MIDL) and see the warning:
    huh.idl(38) : warning MIDL2039 : interface does not conform to 
    [oleautomation] attribute :   [ Parameter 'd' of Procedure 'MIDL2039' ( 
    Dispinterface '_IFoo1Events' ) ]
    						

Modification Type:MajorLast Reviewed:12/2/2003
Keywords:kbBug kbCompiler kbfix kbNoUpdate KB232778