idl

Apache Thrift系列详解(一)- 概述与入门

倾然丶 夕夏残阳落幕 提交于 2020-01-08 12:25:40
前言 Thrift是一个轻量级、跨语言的远程服务调用框架,最初由Facebook开发,后面进入Apache开源项目。它通过自身的IDL中间语言, 并借助代码生成引擎生成各种主流语言的RPC服务端/客户端模板代码。 Thrift支持多种不同的编程语言,包括C++、Java、Python、PHP、Ruby等,本系列主要讲述基于Java语言的Thrift的配置方式和具体使用。 正文 Thrift的技术栈 Thrift对软件栈的定义非常的清晰, 使得各个组件能够松散的耦合, 针对不同的应用场景, 选择不同是方式去搭建服务。 Thrift软件栈分层从下向上分别为:传输层(Transport Layer)、协议层(Protocol Layer)、处理层(Processor Layer)和服务层(Server Layer)。 传输层(Transport Layer):传输层负责直接从网络中读取和写入数据,它定义了具体的网络传输协议;比如说TCP/IP传输等。 协议层(Protocol Layer):协议层定义了数据传输格式,负责网络传输数据的序列化和反序列化;比如说JSON、XML、二进制数据等。 处理层(Processor Layer):处理层是由具体的IDL(接口描述语言)生成的,封装了具体的底层网络传输和序列化方式,并委托给用户实现的Handler进行处理。 服务层(Server

How do I declare an IStream in idl so visual studio maps it to s.w.interop.comtypes?

狂风中的少年 提交于 2019-12-30 12:20:31
问题 I have a COM object that takes needs to take a stream from a C# client and processes it. It would appear that I should use IStream. So I write my idl like below. Then I use MIDL to compile to a tlb, and compile up my solution, register it, and then add a reference to my library to a C# project. Visual Studio creates an IStream definition in my own library. How can I stop it from doing that, and get it to use the COMTypes IStream? It seems there would be one of 3 answers: add some import to

Trouble Casting COM Object to a C#/.NET Class

落爺英雄遲暮 提交于 2019-12-24 14:44:13
问题 I have a base class that is written in C# that implements an interface defined in an IDL library. I have a C++ class that manages the single instance of this class. I also have a C# project that needs to make use of this class [instance (that is obtained through the C++ project)]. I want to cast the COM interface that my base class implements back into my C# base class. However, when I cast the generic object that I acquired from the C++ proportion into my C# base class, I received an error.

Trouble Casting COM Object to a C#/.NET Class

风流意气都作罢 提交于 2019-12-24 14:31:50
问题 I have a base class that is written in C# that implements an interface defined in an IDL library. I have a C++ class that manages the single instance of this class. I also have a C# project that needs to make use of this class [instance (that is obtained through the C++ project)]. I want to cast the COM interface that my base class implements back into my C# base class. However, when I cast the generic object that I acquired from the C++ proportion into my C# base class, I received an error.

Callbacks in COM objects

为君一笑 提交于 2019-12-24 10:03:06
问题 I have an ATL project which exposes a COM object. I would like my COM object to call a function specified by the consumer from time to time, or via some other means of notifying the consumer from time to time. I have tried adding a method in CerberusNative.idl in order to take void function pointers which I would like to call from the COM instance side of things so that the consumer would just need to tell the COM object upon initialization what its callbacks are: interface ICerberusSession :

Issues Using Midl to create a .tlb from .idl “expecting a type specification”

[亡魂溺海] 提交于 2019-12-24 04:17:12
问题 I have been having a prolonged encounter with the beast known as COM Interop... I am currently trying to generate a .tlb from a .idl file generated by the OLE/COM Object Viewer. However when trying to run Midl.exe to compile it I get an error: .\Sim.API.IDL(236) : error MIDL2025 : syntax error : expecting a type s pecification near "ImportFileStatus" My .idl file is more that 1000 lines long so I don't particularly want to post it here however, I believe the Part of interest is: typedef [uuid

How to specify user defined type parameters in COM interface definition?

给你一囗甜甜゛ 提交于 2019-12-24 00:47:11
问题 One of my COM interface methods needs a parameter of user defined type as below: [uuid(58ADDA77-274B-4B2D-B8A6-CAB5A3907AE7), object] //Interface interface IRadio : IUnknown { ... HRESULT test_method2(someUDT* p2p_UDT); ... }; How could fit the definition of the someUDT in the *.idl file? The someUDT type is a user defined struct. Thanks. 回答1: Perhaps this helps you - it's german but the most interesting part is the code. This is how a Struct is defined there: [ uuid(62D33614-1860-11d3-9954

How to prevent coclass implementations from being exposed in an ATL type library

别来无恙 提交于 2019-12-23 18:04:04
问题 I am building an ATL type library with a type of class factory. Something sorta like this: [ object, uuid(...), ... ] interface INumber : IDispatch { [propget, id(0)] HRESULT Value([out, retval] LONG* pVal); } [ object, uuid(...), ... ] interface INumberFactory : IDispatch { [id(1)] HRESULT GetNumber([in] BSTR numberName, [out, retval] INumber* pVal); } [ uuid(...) ] coclass NumberFactory { [default] interface INumberFactory; } The user can then get an instance of a class that implements the

“The type library importer could not convert the signature for the member” warning in a trivial setup

此生再无相见时 提交于 2019-12-23 17:27:48
问题 Observe this most trivial IDL file: import "unknwn.idl"; typedef struct _MyStruct { DWORD len; [size_is(len)] BYTE *buffer; } MyStruct; [ object, uuid(903C11E8-46A0-4E6E-B54C-6619B6A42CCB), pointer_default(unique) ] interface IMyIntf : IUnknown { [local] HRESULT Func([in] MyStruct *pObj); }; [ uuid(BAC6289C-503C-4ADD-B27A-4F22D726C109), version(1.0), ] library Lib { importlib("stdole2.tlb"); [ uuid(76D40083-C27F-45FB-88DC-C3E7DF9B5988) ] coclass MyClass { [default] interface IMyIntf; }; };

Changing a CORBA interface without recompiling

扶醉桌前 提交于 2019-12-23 12:53:11
问题 I'd like to add a method to my existing server's CORBA interface. Will that require recompiling all clients? I'm using TAO. 回答1: Recompilation of clients is not required (and should not be, regardless of the ORB that you use). As Adam indicated, lookups are done by operation name (a straight text comparison). I've done what you're describing with our ACE/TAO-based system, and encountered no issues (servers were in ACE/TAO C++, clients were ACE/TAO C++, C# using Borland's Janeva, and OmniORBPy