views:

188

answers:

5

Hi all,

I have to create a server(java) - client(c++) system, both server and client will have to work with objects (data types) wich are the same for the client and for the server, for example a car object will be created on the client side and then send to the server where aditional calculations will be done on the car object. What i would like to do is to create one universal implementation of the car object and than use this implementation within the server and the client. First i thought about creating a dll (in c++) with all data types wich are same for the client and the server, but this solution has a drawback. Because this solution only works under Windows OS and i have to support Win,Mac,Linux. So is there a multiplatform solution for my problem ?

I give my thanks to all your replyes.

A: 

Take a look at CORBA: http://en.wikipedia.org/wiki/CORBA

TofuBeer
A: 

Provided you stick to standard libraries (cross platform), you shouldn't have any difficulty recompiling your library (DLL) as shared libraries (.so) on OS X and Linux. Of course, loading them in Java is a different issue (which I don't have any expertise in).

However, more importantly, in your case of a client server application, you probably want to look into effective serialization of your objects so that they can transmitted over the network and reliably reconstructed by the receiver.

codelogic
loading them in Java is simple (System.loadLibrary), but they would need to have JNI wrappers for them (that is the likely design for that).
TofuBeer
+3  A: 

Google has an Open Source library called Protocol Buffers for transferring data objects between clients and servers as in your situation. It support C++, Java and Python.

Clint
+1  A: 

as well as protocol buffers, there is another one called thrift (facebook's protocol buffers). see http://incubator.apache.org/thrift/

see this page for a comparison http://stuartsierra.com/2008/07/10/thrift-vs-protocol-buffers

Chii
A: 

This looks like a good job for XML. That's where I would start.

Javamann