Problem compiling IDL created with OleView

1

To correct a problem with the name of the value for the enum, after searching, that I need to modify the TLB file of my DLL. The first step that I need to do is to create the IDL file. So I use Oleview to create the file. Before doing the modification I to correct my problem, I decided to try and compile the IDL file. This gave me the error:

error MIDL2025 : syntax error : expecting a type specification near "AzEnumParameters"

After searching for the problem, I found this question was the way to correct the error. So I change the enum defitions of place and now I'm getting this error:

error MIDL2025 : syntax error : expecting a constant expression near "<"
error MIDL2035 : constant expression expected
error MIDL2025 : syntax error : expecting ) near "IUnknown"

I've got no idea what cause the error since I only inverted my enum definition and the functions defitions. What is causing the last errors in my file?

// Generated .IDL file (by the OLE/COM Object Viewer)
// 
// typelib filename: AccessParam.tlb

[
  uuid(C24F6EAB-4957-34BB-8008-CCABAF1E8B36),
  version(6.0),
  custom(90883F05-3D28-11D2-8F17-00A0C9A6186D, "AccessParam, Version=6.0.5.0, Culture=neutral, PublicKeyToken=null")

]
library AccessParam
{
    // TLib :     // TLib : mscorlib.dll : {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D}
    importlib("mscorlib.tlb");
    // TLib : Esri System Object Library 10.1 : {5E1F7BC3-67C5-4AEE-8EC6-C4B73AAC42ED}
    importlib("esriSystem.olb");
    // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
    importlib("stdole2.tlb");

    // Forward declare all types defined in this typelib
    interface _AccessParameter;
    interface _ManageParameter;

    [
      uuid(388AB2D9-A3A3-3400-8644-F0A3BA43F621),
      version(1.0),
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.AccessParameter")
    ]
    coclass AccessParameter {
        interface _Object;
        [default] interface _AccessParameter;
    };

    typedef [uuid(B59B449B-2757-3E69-A39A-4535A59CD173), version(1.0)    ,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.AccessParameter+AzEnumGDBNames")    
]
    enum {
        AzEnumGDBNames_AzGOcadastre = 0,
        AzEnumGDBNames_AzGOhistorique = 1,
        AzEnumGDBNames_AzGOtravail = 2,
        AzEnumGDBNames_AzGOmatrice = 3,
        AzEnumGDBNames_AzGOmatriceHab = 4,
        AzEnumGDBNames_AzGOmatriceHis = 5
    } AzEnumGDBNames;

    typedef [uuid(94C28066-95C8-3380-A46A-DFECD219E900), version(1.0)    ,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.AccessParameter+AzEnumParameters")    
]
    enum {
        AzEnumParameters_AzConnection = 0,
        AzEnumParameters_AzFuseau = 1,
        AzEnumParameters_AzRepPrinc = 2,
        AzEnumParameters_AzSuffixeGDB = 3,
        AzEnumParameters_AzListMuni = 4,
        AzEnumParameters_AzRepGDB = 5,
        AzEnumParameters_AzRepDataMRN = 6,
        AzEnumParameters_AzRepRapport = 7,
        AzEnumParameters_AzRepRoleFoncier = 8,
        AzEnumParameters_AzRepMatriceScan = 9,
        AzEnumParameters_AzRepArchives = 10
    } AzEnumParameters;

    [
      odl,
      uuid(3CEEDD8D-2A91-3BCB-A620-1D818994EF47),
      version(1.0),
      dual,
      oleautomation,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.AccessParameter+_AccessParameter")    

    ]
    interface _AccessParameter : IDispatch {
        [id(0x00000001), propget]
        HRESULT NomTerritoire([out, retval] BSTR* pRetVal);
        [id(0x00000001), propput]
        HRESULT NomTerritoire([in] BSTR pRetVal);
        [id(0x00000002), propget]
        HRESULT AliasTerritoire([out, retval] BSTR* pRetVal);
        [id(0x00000002), propput]
        HRESULT AliasTerritoire([in] BSTR pRetVal);
        [id(0x00000003), propget]
        HRESULT NomAppli([out, retval] BSTR* pRetVal);
        [id(0x00000003), propput]
        HRESULT NomAppli([in] BSTR pRetVal);
        [id(0x00000004), propget]
        HRESULT DateCreate([out, retval] DATE* pRetVal);
        [id(0x00000004), propput]
        HRESULT DateCreate([in] DATE pRetVal);
        [id(0x00000005), propget]
        HRESULT CountParam([out, retval] short* pRetVal);
        [id(0x00000006), propget]
        HRESULT ToCreate([out, retval] VARIANT_BOOL* pRetVal);
        [id(0x00000006), propput]
        HRESULT ToCreate([in] VARIANT_BOOL pRetVal);
        [id(0x00000007), propget]
        HRESULT CodeParam(
                        [in] short Index, 
                        [out, retval] AzEnumParameters* pRetVal);
        [id(0x00000007), propput]
        HRESULT CodeParam(
                        [in] short Index, 
                        [in] AzEnumParameters pRetVal);
        [id(0x00000008), propget]
        HRESULT ValueParam(
                        [in] AzEnumParameters EnumP, 
                        [out, retval] BSTR* pRetVal);
        [id(0x00000008), propput]
        HRESULT ValueParam(
                        [in] AzEnumParameters EnumP, 
                        [in] BSTR pRetVal);
        [id(0x00000009), propget]
        HRESULT DescripParam(
                        [in] AzEnumParameters EnumP, 
                        [out, retval] BSTR* pRetVal);
        [id(0x00000009), propput]
        HRESULT DescripParam(
                        [in] AzEnumParameters EnumP, 
                        [in] BSTR pRetVal);
        [id(0x0000000a), propget]
        HRESULT EstModifParam(
                        [in] AzEnumParameters EnumP, 
                        [out, retval] VARIANT_BOOL* pRetVal);
        [id(0x0000000a), propput]
        HRESULT EstModifParam(
                        [in] AzEnumParameters EnumP, 
                        [in] VARIANT_BOOL pRetVal);
        [id(0x0000000b), propget]
        HRESULT GetPropertyConnect(
                        [in] AzEnumGDBNames GDB, 
                        [out, retval] IPropertySet** pRetVal);
        [id(0x0000000c), propget]
        HRESULT NameGDB(
                        [in] AzEnumGDBNames EnumGDB, 
                        [out, retval] BSTR* pRetVal);
    };

    [
      uuid(25E50774-0A09-3C1B-A7DA-FBFE54CBFBC9),
      version(1.0),
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.ManageParameter")
    ]
    coclass ManageParameter {
        interface _Object;
        [default] interface _ManageParameter;
    };

    typedef [uuid(5ED0622E-5DC6-3DF6-A568-57DF774744F1), version(1.0)    ,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.ManageParameter+AzEnumAppNames")    
]
    enum {
        AzEnumAppNames_AzAppGOcadastre = 0,
        AzEnumAppNames_AzAppGOmatrice = 1
    } AzEnumAppNames;

    [
      odl,
      uuid(7D8D41B4-EF0A-370B-86BB-163F1A27B568),
      version(1.0),
      dual,
      oleautomation,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.ManageParameter+_ManageParameter")    

    ]
    interface _ManageParameter : IDispatch {
        [id(0x00000001), propget]
        HRESULT LoadParam(
                        [in, optional, defaultvalue(<unprintable IUnknown*>)] VARIANT Index, 
                        [in, optional, defaultvalue(0)] AzEnumAppNames GOapp, 
                        [out, retval] _AccessParameter** pRetVal);
        [id(0x00000002), propget]
        HRESULT LoadParamDefault(
                        [in] BSTR NomApp, 
                        [out, retval] _AccessParameter** pRetVal);
        [id(0x00000003), propget]
        HRESULT GetParamMuni(
                        [in] short Index, 
                        [out, retval] _AccessParameter** pRetVal);
        [id(0x00000004), propget]
        HRESULT Count([out, retval] short* pRetVal);
        [id(0x00000005)]
        HRESULT AddTerritoire([in] _AccessParameter* Param);
        [id(0x00000006)]
        HRESULT SuppTerritoire(
                        [in, out] BSTR* Terr, 
                        [in, out] BSTR* Appli);
        [id(0x00000007)]
        HRESULT UpdateAllMuni();
        [id(0x00000008)]
        HRESULT UpdateMuni([in, out] short* Index);
    };
};
idl
typelib
midl
oleview
asked on Stack Overflow May 5, 2014 by Stephan • edited Feb 4, 2019 by StayOnTarget

1 Answer

1

Found the problem. In the declaration

HRESULT LoadParam(
    [in, optional, defaultvalue(<unprintable IUnknown*>)] VARIANT Index, 
    [in, optional, defaultvalue(0)] AzEnumAppNames GOapp, 
    [out, retval] _AccessParameter** pRetVal);

The unprintable IUnknown* was causing the error. I remove the defaultvalue declaration for the index field and everything compile.

answered on Stack Overflow May 6, 2014 by Stephan

User contributions licensed under CC BY-SA 3.0