Thrift generates different code for each of its target languages, and if a 
protocol/transport is supported at all it should work the same on every 
language.

I expect the serialisation overhead: every request you make to Google or 
Facebook or even ODBC/JDBC already goes through heaps of that.

It just isn't that easy to work out exactly what is built into Thrift other 
than the default socket interface, and what works across which languages, which 
is why the question here.

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org


-----Original Message-----
From: Stig Bakken [mailto:[email protected]] 
Sent: Tuesday, 15 September 2015 7:41 PM
To: [email protected]
Subject: Re: Thrift as an in-process server?

It would be possible, but you must handle compatibility in a way that works 
with Thrift.

For example, you could have a mechanism for getting an implementation of a 
service interface from the library, but if that library was built with 
generated code that does not align with what the (C/C++) program was built 
with, you may end up with pointers going where you don't want them (feel free 
to correct me here, anyone more familiar with Thrift's C++ generator).
For more dynamic languages, this technique should work though.

The way Thrift handles compatibility is through the protocol and transport 
layers, which means you must serialize and deserialize data for every single 
call. You would need some kind of initialization that creates a transport 
shared between the shared lib and the main process, and agree on the protocol 
and service. This transport could use in-process memory to temporarily store 
serialized parameters and return values (you may be able to just use the memory 
buffer, but I suspect you'll have to roll your own).

So, possible, yes.

 - Stig



On Mon, Sep 14, 2015 at 3:57 AM, David Bennett <[email protected]> wrote:

> Is it possible to use Thrift for in-process cross-language marshalling?
>
> For a mobile or desktop app there is no particular benefit in running 
> a socket-based server, and it's much easier to install and start up an 
> app that makes an in-process call to a dynamic library.
>
> So is this possible?
>
> Regards
> David M Bennett FACS
>
> Andl - A New Database Language - andl.org
>
>
>


--
Stig Bakken
CTO, Zedge.net - free your phone!

Reply via email to