从 C++ 进行 Thrift 调用 Windows 中的应用程序

发布于 2024-07-08 07:35:47 字数 286 浏览 11 评论 0原文

正如标题所示,我有一个用 C++ 编写的 Windows 应用程序,我需要从中调用远程 Thrift 服务,说实话,我对这个主题有点迷失。 http://wiki.apache.org/thrift/ThriftInstallationWin32 指出“Thrift C++ 运行时库当前无法在 Windows 上运行”。 这是否意味着我运气不好,或者有解决方法吗?

As the title says, I have a Windows app written in C++ from which I need to make calls to remote Thrift services, and I'm a bit lost on the subject, to be honest. http://wiki.apache.org/thrift/ThriftInstallationWin32 states that "The Thrift C++ runtime library does not currently work on Windows". Does that mean I'm shit out of luck, or is there a workaround?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

温柔少女心 2024-07-15 07:35:47

我将 Thrift 移植到 Windows/C++ 作为我自己的应用程序。 它是开源的,因此其他人可以免费使用它:http://peoplesnote.codeplex .com/SourceControl/list/changesets

I ported Thrift to Windows/C++ for my own app. Its open-source, so other people are free to make use of it: http://peoplesnote.codeplex.com/SourceControl/list/changesets

站稳脚跟 2024-07-15 07:35:47

它可能不是一个优雅的解决方案,但至少它应该可以工作:

根据 Thrift Wiki,有 C# 绑定,但它们实际上应该被称为 .NET 绑定:它们没有任何特定于 C# 的内容。 因此,您可以在 C++/CLI dll 库中实现通信库,并从非托管代码引用该 .dll。

It might not be an elegant solution, but at least it should work:

According to the Thrift Wiki there are C#-bindings, but they really should be called .NET-bindings: there is nothing C#-specific about them. So you could implement your communication-library in a C++/CLI dll-library and reference that .dll from your unmanaged code.

扶醉桌前 2024-07-15 07:35:47

该页面看起来相当简单。 他们告诉您如何制作 Thrift 编译器,但明确指出,其中的元代码无法在 Windows 下编译。

因此,如果没有人弄清楚如何在 Windows 下编译它,您就运气不好。

老实说,我不明白这有什么大不了的,特别是因为 Cygwin 很好地提供了在 Windows 下编译 UNIX 源代码所需的一切。 我只能建议他们一定使用了一些相当深奥的 UNIX 功能。

这里可以采取多种方法:

1/ 既然已经进入 Apache 孵化器,可能有支持 Windows 的计划(虽然我找不到任何计划)。 如果它是真正开源的并且确定了需求,那么很可能有人会开始将运行时移植到 Windows。 您可能等不及了。

2/ 为什么世界需要另一个 RPC 机制我无法理解。 但是您可以使用现有的 RPC 机制 (SUN/ONC) 之一或您自己的 RPC 协议从 Windows 机器到 UNIX 机器进行通信,然后通过 Thrift 转发 RPC。 但这是一个拼凑,我不会出于原则这样做。

除此之外,我没什么可以建议的了,抱歉。 祝你好运。

That page seems fairly straightforward. They tell you how to make the Thrift compiler but state, in no uncertain terms, that the metacode from it won't compile under Windows.

So, short of getting someone to figure out how to compile it under Windows, you are out of luck.

To be honest, I can't see how that would be that big a deal, especially since Cygwin pretty well provides everything you need for compiling UNIX sources under Windows. I can only suggest they must be using some fairly esoteric UNIX functionality.

There are a number of approaches to take from here:

1/ Since it's entered the Apache Incubator, there may be plans to support Windows (although I can't find any). If it's truly open source and a need is identified, it's likely someone will start porting the runtimes to Windows. You may not be able to wait.

2/ Why the world needed another RPC mechanism is beyond me. But you could use one of the already-existing RPC mechanisms (SUN/ONC) or your own RPC protocol to communicate from you Windows box to a UNIX box, that then forwards the RPC via Thrift. But this is a kludge and I wouldn't do it out of principal.

Other than that, not much else I can suggest, sorry. Best of luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文