从头文件生成idl文件时出错 [英] error generating idl file from header file

查看:160
本文介绍了从头文件生成idl文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

有几个专有实现的COM接口:

There are a couple of COM interfaces with proprietary implementations:

https://www.prepar3d.com /SDKv4/sdk/pdk_api/service_providers/group__weatherservice.html#class_p3_d_1_1_i_weather_system_v430

https://www.prepar3d.com/SDKv4/sdk/pdk_api/service_providers/group__weatherservice.html#class_p3_d_1_1_i_weather_system_v430

如果我编写可以调用的插件,我可以访问他们提供的天气相关功能并阅读天气参数by P3d。

I am able to access the weather-related functions they provide and read the weather parameters if i write plugins that can be invoked by P3d.

但我的要求是从C#客户端控制台访问它们,这意味着我需要COM对象。只有头文件可用。

But my requirement is to access them from a C# client console, which means I need COM objects. Only the header files are available.

所以我想如果我可以根据头文件写一个idl,我可以编译它来生成相应的tlb并将它们包含在我的C#项目中,并打电话给他们。

So I thought if I could write an idl based on the header file, I could compile it to generate the corresponding tlb and include these in my C# project, and call them.

1。这种方法有用吗?

1. Would this approach work?

2。当我尝试创建idl时,我试图在其中包含头文件:

2. When I tried to create the idl, I attempted to include the header file in it as:

import "oaidl.idl"; import "ocidl.idl"; import "unknwn.idl"; [ object, uuid(27075dbf-09fc-4e5a-8808-f7a81525d075),// the iid of the iweathersystem interface helpstring("interface to access PDK weather parameters") ] interface IWeatherSystemV430 :IUnknown { include "IWeatherSystem.h" CLOUD_COVERAGE_DENSITY GetCloudCoverageDensity(); HRESULT SetCloudCoverageDensity(__in CLOUD_COVERAGE_DENSITY eDensity);

..........

..........

..........

..........

}

但我收到错误:期待一个类型规格靠近"包括"。尝试导入也不起作用。你能指导我如何解决这个问题吗?

But I get the error: expecting a type specification near "include". Trying import too doesn't work. Can you please guide me on how to resolve this?

谢谢你

推荐答案

Hello Anuchen,

Hello Anuchen,

1。 >>这种方法会起作用吗?

1. >> Would this approach work?

1.1否定,Anuchen。这不是生成IDL文件的方法。

1.1 Negative, Anuchen. This is not the way to generate an IDL file.

1.2 IDL文件通常由Visual Studio等工具自动生成。

1.2 An IDL file is normally automatically generated by a tool such as Visual Studio.

1.3此外,C / C ++头文件通常是从IDL文件生成的,而不是相反。

1.3 Furthermore, a C/C++ header file is usually generated -from- an IDL file and not the other way around.

2。我知道您可能会受到您在帖子中表达的担忧的激励

获取指向COM接口的指针

2. I understand that you are probably motivated by the concerns you expressed in your post getting pointer to COM Interface.

2.1根据RLWA32的建议,您最好联系prepar3d的工作人员以获得更好和更直接的支持。

2.1 As suggested by RLWA32, it is best that you contact the staff at prepar3d for better and more direct support.

- 生物。


这篇关于从头文件生成idl文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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