[cfe-dev] Clang server with Thrift

Piotr Kukiełka piotr.kukielka at gmail.com
Sat Jan 5 16:11:56 PST 2013


Yeah, you can bind to C API in most languages, but you still need to
write some king of wrapper ofr it.
This means that for every single language you need to maintain ~1000
lines of code.

Thrift works in other way. When you define API using Thrift you can
automatically generate server and client in
several languages. Clang server need to be written in  C++ so you can
implement its methods using
calls to Clang library. But all the clients can be auto generated and
doesn't require any work at all.
This means you need to maintain only Thrift API and it's
implementation on the server side.

The only downside of this method is that you need to always run second
process (server) and communication
with it is more expensive than direct call (however I don't believe
that latency would be significant here).

2013/1/5 Sean Silva <silvas at purdue.edu>:
> On Fri, Jan 4, 2013 at 3:36 PM, Piotr Kukiełka <piotr.kukielka at gmail.com> wrote:
>> IMHO possible solution to the problem would be to use Thrift to define
>> Clang API.
>> It would be based on current C API, with changes when needed (Thrift
>> support only passing by value).
>> That would allow us to generate C++ server and clients in virtually
>> any language (C++, C#, Cocoa, D, Delphi, Erlang, Haskell, Java, OCaml,
>> Perl, PHP, Python, Ruby, Smalltalk). Server would require some work
>> (but still much, much less than in original proposal) and clients
>> would require no work at all to create.
>
> I have never used Thrift, but is a Thrift API going to be easier to
> bind to than the existing C API? I'm pretty sure that every language
> can bind to a C API.
>
> -- Sean Silva




More information about the cfe-dev mailing list