Is there a way with MIDL to turn off C-style headers generation?

无人久伴 提交于 2019-12-11 02:18:44

问题


I have a simple .IDL file (iface.idl) which describes an IUnknown based interface:

import "unknwn.idl"; 
[
    uuid(80DFDD28-F033-431e-B027-CDD2078FC78A)
]
interface ISunPathCalc : IUnknown {
    HRESULT Square([in, out] long * pVal);
    HRESULT Cube([in, out] long * pVal);
};

When trying to compile it with midl /header iface.h iface.idl I'm getting 3 files: iface.h, iface_i.c and iface_p.c. The iface.h file contains a C++ declaration of ISunpathCalc interface:

#if defined(__cplusplus) && !defined(CINTERFACE)

    MIDL_INTERFACE("80DFDD28-F033-431e-B027-CDD2078FC78A")
    ISunPathCalc : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE Square( 
            /* [out][in] */ long *pVal) = 0;

        virtual HRESULT STDMETHODCALLTYPE Cube( 
            /* [out][in] */ long *pVal) = 0;

    };

#else   /* C style interface */

The remaining larger part of this file contains needless C stuff.

Q: Is there way to tell MIDL to generate only C++ part of header? Is it possible to switch off generation of iface_i.c and iface_p.c files and to force MIDL to generate a C++ definition instead?

UPD1:

I tried to add [local] attribute as specified here:

[
    local,
    uuid(80DFDD28-F033-431e-B027-CDD2078FC78A)
]

but without any success.


回答1:


Unfortunately there's no way of suppressing the C header generation.



来源:https://stackoverflow.com/questions/6255268/is-there-a-way-with-midl-to-turn-off-c-style-headers-generation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!