views:

1499

answers:

4

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?

A: 

It says that it supports C#, so they puts your shit back on the stack (no overflows please!).

kenny
Was that supposed to be meaningful in any way?
korona
Is C++ your only option? Can't you write a C# module and use it in a C++ app with COM Interop?
kenny
I guess, but that sounds overly complex and it's really only something I'd resort to as a last option.
korona
+3  A: 

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.

Rasmus Faber
+1  A: 

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.

paxdiablo
+1  A: 

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

Don Reba