Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making Thrift calls from a C++ app in 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?

like image 805
korona Avatar asked Oct 30 '08 12:10

korona


3 Answers

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

like image 159
Don Reba Avatar answered Nov 08 '22 17:11

Don Reba


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.

like image 24
Rasmus Faber Avatar answered Nov 08 '22 18:11

Rasmus Faber


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.

like image 44
paxdiablo Avatar answered Nov 08 '22 17:11

paxdiablo