有没有办法与MIDL关闭C风格头生成? [英] Is there a way with MIDL to turn off C-style headers generation?

查看:206
本文介绍了有没有办法与MIDL关闭C风格头生成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的.IDL文件(iface.idl),它描述了一个基于IUnknown的接口:

  importunknwn。 idl; 
[
] [
uuid(80DFDD28-F033-431e-B027-CDD2078FC78A)
]
接口ISunPathCalc:IUnknown {
HRESULT Square([in,out] long * pVal );
HRESULT Cube([in,out] long * pVal);
};

尝试使用 midl / header iface.h iface.idl 我得到3个文件:iface.h,iface_i.c和iface_p.c。 iface.h文件包含ISunpathCalc接口的C ++声明:

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

有没有办法告诉MIDL只生成标头的C ++部分?
是否可以关闭iface_i.c和iface_p.c文件的生成,并强制MIDL生成一个C ++定义?



UPD1 :



我尝试添加指定的[local]属性此处

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


不幸的是,没有办法抑制C头生成。


解决方案

>

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.

解决方案

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

这篇关于有没有办法与MIDL关闭C风格头生成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆