Click here to Skip to main content
Click here to Skip to main content

RMI for C++

By , 6 Aug 2009
 

Please Note

This article is quite old now. The code samples still compile with current versions of RCF, but for up to date information, please refer to this article:

RCF - Interprocess Communication for C++

Introduction

The officially sanctioned way of making distributed function calls between C++ programs is to use CORBA, but for many applications, this is overkill. The CORBA specifications allow distributed function calls to be made between code written in any number of languages, and to make it all work, specialized tools need to be integrated into the build process, in order to translate object definitions written in CORBA's IDL to whichever native language is being used (C++, Java, etc.).

However, if we assume that the server and client are both written in the same language, let us assume C++, since it is possible to do away with these complexities. In particular, instead of elaborate definitions of interfaces and marshalling specifications, we can simply defer to C++.

Instead of separate IDL files with object interfaces, we specify the interfaces directly in C++ source code, using the preprocessor, and to marshal arguments across process boundaries, we use the native C++ serialization framework provided in the latest release of the Boost library.

A Simple Example

As an example, a simple echo server looks like this:

#include <RCF/RCF.hpp> 


RCF_BEGIN(I_Echo, "I_Echo")
  RCF_METHOD_R1(std::string, echo, const std::string &);
RCF_END(I_Echo);

class Echo
{
public:
  std::string echo(const std::string &msg) { return msg; }
};

int main()
{
  int port = 50001;
  RCF::RcfServer server(port);
  server.bind<I_Echo, Echo>();
  server.start();
  return 0;
}

And the client:

#include <RCF/RCF.hpp>


RCF_BEGIN(I_Echo, "I_Echo")
  RCF_METHOD_R1(std::string, echo, const std::string &);
RCF_END(I_Echo);

int main()
{
  std::cout << RcfClient<I_Echo>("localhost", 
                               50001).echo("my message");
  return 0;
}

The Boost.Serialization library is used to serialize parameters and return values. It handles standard types and containers automatically, and is easily extended to user defined classes. It also allows us to serialize pointers, with proper handling of polymorphic pointers and multiple pointers to single objects.

Basic Usage

There are three basic steps to using this framework:

  1. Use the RCF_xxx macros to define interfaces.
  2. Use the RcfServer class to expose objects that implement the interface.
  3. Use the RcfClient<> classes to invoke methods on the objects exposed by the server.

The interface definition macros are used as follows:

RCF_BEGIN( type, type_id )
  // ...

  RCF_METHOD_xx( return_type, name, ....):
  // ...

RCF_END( type )

type is the identifier for the interface, type_id is a string giving a runtime description of the interface. The RCF_METHOD_xx macros define the member functions, and are named according to the number of arguments and whether the return value is void or not. So, for a function func accepting two strings and returning an integer, we write:

  RCF_METHOD_R2(int, func, std::string, std::string);

and if the function has a void return type, we would instead write:

  RCF_METHOD_V2(void, func, std::string, std::string);

Dispatch IDs for each function are generated automatically; the first member function is numbered 0, the next one 1, and so on. So, the order in which the functions appear in the definition is important, unlike in CORBA, where dispatch IDs are based on the function name. The dispatch IDs are generated using templates and not any preprocessor __LINE__ trickery, so the interface does not change if blank lines are inserted. The maximum number of member functions that can appear between RCF_BEGIN() and RCF_END() is at the moment limited to 25, but this limit is arbitrary.

The purpose of the RCF_xxx macros is to define the class RcfClient<type>. This class serves as a client stub, from the user's point of view, but also has facilities that allow the framework to use it as a server stub. These macros can be used in any namespace, not just the global namespace.

Once we have defined an interface using the RCF_xxx macros, we can start a server and bind the interface to concrete objects:

{
  // create the server and tell it which port to listen on

  RCF::RcfServer server(port);

  // Interface is the identifer of the interface we're exporting,

  // Object is a type that implements that interface

    
  // one object for each client

  server.bind<Interface, Object>(); 

  // ... or one object shared by all clients

  Object object;
  server.bind<Interface>(object); 

  // tell the server to start listening for connections

  server.start();

  // ...


  // the server will shut down automatically as it goes out of scope

}

The objects are statically bound to the corresponding interface; there is no need for the object to derive from an interface class as is the case for traditional dynamic polymorphism. Instead, the compiler resolves the interface at compile time, which is not only more efficient, but also allows more flexible semantics.

The server can handle multiple simultaneous clients, even in single threaded mode, and can be stopped at any time. The lifetime of objects exposed by the server is determined by the number of current connections to the given object; once there are no more live connections to the object, a timeout is set, and when it expires, the object is deleted.

To make a client call, we instantiate the corresponding RcfClient<> template and pass the server IP and port number to the constructor. When the first remote method is called, the client then attempts to connect to the server, queries for the given object, invokes the requested member function of the remote object, and then returns the remote return value.

// define the interface

RCF_BEGIN(Interface, "Interface")
  RCF_METHOD_R2(int, add, int, int);
RCF_END(Interface);

// ...


{
  std::string ip = "localhost";
  int port = 50001;
  RcfClient<Interface> client(ip, port);
  
  // connect and call the add function

  int sum = client.add(1,1);
  
  // connection closed as we exit scope

}

Should any exceptions arise on the server side while invoking the requested object, an exception of type RCF::RemoteException will be propagated back to the client and thrown. Should any exceptions arise anywhere else on the server side, e.g., while serializing arguments, then the server will forcibly close the connection, and the client will throw an exception.

RCF will automatically handle a range of parameter types, including C++ primitive types (int, double, etc.), std::string, STL containers, and pointers and references to any of the previously mentioned types. Polymorphic pointers and references, and multiple pointers to single objects are correctly handled as well. Smart pointers are also supported (boost::shared_ptr, std::auto_ptr), and are the safest way of passing polymorphic parameters.

In CORBA, one can tag a parameter as in, out, or inout, depending on which direction(s) one wants the parameter to be marshaled. In RCF, the marshaling directions are deduced from the parameter type, according to the following conventions:

Value: in
Pointer: in
Const reference: in
Nonconst reference: inout

Nonconst reference to pointer: out

To use user-defined types as parameters or return values, some additional serialization code is needed. What that code is depends on which serialization protocols are being used; by default Boost.Serialization is used, and an example of passing a user-defined type would look like the following:

struct MyStruct
{
  int a;
  int b;
  int c;
  double d;
  std::string s;
  std::map <std::string, std::vector<std::string> > m;
  
  template<typename Archive>
  void serialize(Archive &archive, unsigned int version)
  {
    ar & a & b & c & d & s & m;
  }
  
};

RCF_BEGIN(MyInterface, "MyInterface")
  RCF_METHOD_R1(MyStruct, myfunc, const MyStruct &);
RCF_END(MyInterface);

Details

The server and client classes use BSD-style sockets to implement the networking, over TCP, and the whole framework has been compiled and tested on Linux, Solaris (x86 and SPARC) and Win32, using Visual C++ 7.1, Codewarrior 9.0, Borland C++ 5.5, and GCC 3.2. Building RCF requires v. 1.32.0 or later of the Boost library, although the only parts of Boost that need to be built are Boost.Serialization, and, for multithreaded builds, Boost.Threads. Multithreaded builds are enabled by defining RCF_USE_BOOST_THREADS before including any RCF headers.

To use RCF in your own application, you'll need to include the src/RCF.cpp file among the sources of the application, and link to the necessary libraries from Boost, along with OS-specific socket libraries (on Windows that would be ws2_32.lib, on Linux libnsl, etc.).

I've included a demo project for Visual Studio .NET 2003, which includes everything needed to compile, link, and run a server/client pair, with the exception of the Boost library, which needs to be downloaded and unzipped, but no building is needed.

Performance, as measured in requests/second, is highly dependent on the serialization protocol, and also on the compiler being used. Before turning to Boost.Serialization, I used a serialization framework of my own, with which I could clock around 3000 minimal requests/sec. using Visual C++ 7.1, and 3300 requests/sec. with Codewarrior 9.0, on a loopback connection on a 1400Mhz, 384Mb PC running Windows XP. GCC 3.2, on the other hand, was far slower. Using Boost.Serialization, however, I've been nowhere near these numbers; on average, it's around five times slower.

Conclusion

RMI is a well known concept in Java circles, what I've done here is to do something similar in C++, without all the complications of CORBA. If you like it, please tell me, if you don't, well, please tell someone else.... Jokes aside, any and all feedback is appreciated, all I ask is that if you grade the article, and do so with a low grade, then please leave an explanatory comment!

History

  • 8 Feb 2005 - First release.
  • 10 Mar 2005
    • Now includes a custom serialization framework, so you no longer have to use Boost's. Both serialization frameworks are supported though, use the project-wide RCF_NO_BOOST_SERIALIZATION and RCF_NO_SF_SERIALIZATION defines to control which ones are used. Default behaviour is to compile both.
    • Default client timeout changed to 10s.
    • Server can be configured to only accept clients from certain IP numbers.
    • Server can be configured to listen only on a specific network interface, such as 127.0.0.1.
    • Client stubs themselves are now properly serializable.
  • 4 April 2005

    More bugfixes, including:

    • Much-improved network performance (thanks to Jean-Yves Tremblay for finding the bug).
    • Shortened exception messages in release builds.
    • Client stubs automatically reset their connections when exceptions are thrown (eg for timeouts).
    • Finer-grained exception classes.
  • 11 July 2005
    • Stripped CVS folders from distribution.
    • Added user-definable callback functions to be called when RcfServer has started.
  • 16 Aug 2005
    • Added facilities for server-bound objects to query the IP address of the client that is currently invoking them. To see how it works, open the file RCF/test/Test_ClientInfo.cpp in the download. Just place a call to RCF::getCurrentSessionInfo().getClientInfo().getAddress(), and you'll receive a string containing the IP address of the client that is invoking the method.
  • 23 Sep 2005
    • Initialization and deinitialization of the framework can now be done explicitly, be defining the project-wide preprocessor symbol RCF_NO_AUTO_INIT_DEINIT, and then calling RCF::init() and RCF::deinit() at appropriate times. This is mainly useful for DLL builds, so that the DLL can be loaded without automatically initializing Winsock.
  • 19 Oct 2005
    • Compatible with Boost 1.33.0.
    • Added enum serialization to the built-in serialization engine, through the SF_SERIALIZE_ENUM macro. For an example of its use, see test/Test_Serialization.cpp.
    • Added a license.
  • 30 Jan 2006
    • Miscellaneous bugfixes.
    • The built-in maximum message size limit has been changed to 50 Kb. Look in src/RCF/Connection.cpp, line 374, if you need to change this.
    • I'll only be making sporadic maintenance releases of this version of RCF from now on. You can find the next generation of RCF here.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Jarl Lindrud
Australia Australia
Member
Software developer, ex-resident of Sweden and now living in Canberra, Australia, working on distributed C++ applications. Jarl enjoys programming, but prefers skiing and playing table tennis. He derives immense satisfaction from referring to himself in third person.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralInteroperability with other languages.memberVess Bakalov27 Apr '08 - 16:25 
This looks like a great library.
 
I am wondering if compatible implementations exist in Perl or PHP or Python or any other popular scripting language?
 
I am looking for something that would give me the interoperability of SOAP, without the performance penalty.
 
To give you a bit more details - I am looking for a framework to use for an open API project, but I do not want to have to re-implement the API for every single target language. SOAP gives us this flexibility. However in certain cases high volumes of messages need to be exchanged, and in those cases SOAP becomes a major performance bottleneck.
 
I am sorry if this has already been answered, but I did search the forum as best as I could.
 
Thanks!
 
vess
 
P.S. If I am looking at the wrong tool, and there are better suggestions, please let me know as well.
GeneralRe: Interoperability with other languages.memberJarl Lindrud29 Apr '08 - 0:34 
Hi,
 
RCF is implemented in C++ only, so from other languages you would need to write a wrapper for a C++ layer that handles the network communication.
 
Regards,
Jarl.
QuestionIPC probs/speedmemberMember 387363213 Mar '08 - 3:37 
Hi All
 
I'm novice on this forum, sorry for possible confusions.
 
My task is to port a 3d render engine from 32-bits to 64. There are a lot of things are (at least) difficult to port (GUI, QuickTime calls, plug-ins, shaders etc). Thus I plan to port "core" to 64 and leave other parts in 32. The only way to do this is to have 2 processes (one 32-bits, another one 64) and organize their interactions. So my questions are:
 
1) Can I use RCF for OSX (Carbon) platform?
2) Can I use RCF for Windows platform?
3) What is a fastest IPC (no probs if it's low-level/primitive, speed is critical for me)?
 
Thank you
 
Igor
GeneralRe: IPC probs/speedmemberJarl Lindrud14 Mar '08 - 0:27 
Hi Igor,
 
First of all, this article refers to an old version of RCF... The new one is here:
 
http://www.codeproject.com/KB/threads/Rcf_Ipc_For_Cpp.aspx
 
, and the project homepage is here:
 
http://code.google.com/p/rcf-cpp/
 
RCF works well as a 32/64 bit bridge, I've seen it used for that purpose myself. As for your questions,
 
1) Probably, with some minor tweaking. I don't have access to an OSX platform to test on, but I know users who have made small changes to RCF, and been able to run it on OSX.
 
2) Yes.
 
3) In RCF 0.9c you would be best off using TCP. UDP is faster, but doesn't offer any form of connection-oriented interaction, which is often a deal-breaker.
 
RCF will, probably in the next release, support named pipe transports on Windows, which will be a bit faster than TCP. TCP on a localhost connection is quite fast though, most applications would not have a problem with it.
 
Regards,
Jarl.
QuestionAsync featuresmemberhulkaspeed19 Nov '07 - 0:31 
Hi Jarl,
First,only tell you that I think this is one of the best and more usable code ever written!!
Now, I only have one question,how can I develop an asynchronous call?could you give me an example??
 
Thanks
 
Hulka
AnswerRe: Async featuresmemberJarl Lindrud19 Nov '07 - 14:01 

Thanks hulka. By the way, there are much newer versions of RCF, have a look here:
 
http://www.codeproject.com/threads/Rcf_Ipc_For_Cpp.asp
 
Asynchronous calls are not yet built in to RCF, but I am working on that right now... The next release of RCF will have native asynchronous capability, but until then, if you need a thread to do something while a call is pending, you can either use client progress callbacks, or start your own background threads, and queue up remote calls on that while the main thread does something else.
 
In RCF 0.9c, have a look in Test_ClientProgress.cpp to see how client progress callbacks are used.
 
Cheers,
jarl.

QuestionHow to use array in argument?memberykishii_hitachi10 Jul '07 - 19:25 
Hello Jarl,
 
I’m trying to use your RCF. Start of all, I started the next interface.
RCF_METHOD_V1(void, func1, std::vector)
This test works well.
OS : Redhat Linux WS4
Machine : IBM Thinkpad X41
Development Environment: Eclipse 3.2 with CDT
using NO_BOOST_SERIALIZATION option.
 
In the next case, I started to build next 2 interface.
 
(1) 1’st case -- Static Array Version
typedef int intarray[100];
:
RCF_METHOD_V1(void, func1, intarray)
 
In this case , I can compile source code, but in runtime, I encountered the next runtime error in client side.
[Error Message]
Caught exception;
Type: N3RCF18RecvCloseExceptionE
What: ../../RCF/include/RCF/Marshal.inl(77); RCF::IDL::InReturnValue ::InReturnValue(RCF::Connection&,ool): :Thread-id=0 : Timestamp(ms)=51465:THROW:RCF:RecvCloseException: connection closed by server
 
(2) 2’nd case -- Dinamic Array Version
typedef SF::DynamicArray IntArray;
:
RCF_METHOD_V1(void, func1, IntArray)
 
In this case, compiler generates error! In Compile process, code “RCF_METHOED_V1(void, func1, IntArray)” is perhaps converted to a code to instantiate “SF::DynamicArray” with no argument. but in SF/SerializeDynamicArray.hpp, no default creator is defined. So error is generated(I guess from complier error message).
 
Please tell me how can I use Array in RCF argument.
 
Best regards
ykishii
AnswerRe: How to use array in argument?memberJarl Lindrud10 Jul '07 - 20:16 

First of all, you need to use a newer version of RCF:
 
http://www.codeproject.com/threads/Rcf_Ipc_For_Cpp.asp
 
To send an array of integers, you should use std::vector as the type of the parameter. Static arrays like int[] are not supported as interface parameters. SF::DynamicArray is an internal implementation class, and is not intended for use as an RCF interface parameter, either.
 
Regards,
Jarl.

GeneralRe: How to use array in argument?memberykishii_hitachi10 Jul '07 - 23:08 
Thank you, Mr. Jarl,
 
RCF_METHOD_V1(void, func1, std::vector<int>)
This test works well. The next data present the elapsed time for remote call, this shows that remote call requires the time linear to the data length.
 
Size of vector elapsed time(average of 1000 calls)
10 0.00164335[s/call]
100 0.00270757[s/call]
1000 0.0109117[s/call]
10000 0.0927689[s/call]
100000 0.931833[s/call]
 
I want to speed up remote method call, and I think that Array may be sent more quickly.
Former question is to confirm this hypothesis, but not supported by RCF.
 
Is there any advice to shorten the time required to the remote call(with large vector data)?
 
Regards,
ykishii.
GeneralRe: How to use array in argument?memberJarl Lindrud25 Jul '07 - 21:42 
Hi ykishii,
 
Sorry for the late response... If you get the latest version of RCF, RCF 0.9c, available here , you can use the RCF::ByteBuffer class as a parameter in your interfaces, and that should be a lot faster than using std::vector with older versions of RCF.
 
Regards,
jarl.
QuestionRCF::RecvTimeoutExceptionmemberPetr4822 Jun '06 - 22:14 
I would need to solve this problem:
If some remote function does not respond to the client RCF::RecvTimeoutException is thrown.
But how to kill a remote function on the server which caused this exception.
Could you help me ?
Thanks,
Petr
 
http://www.codeproject.com/script/profile/confirm.asp?i=3129526&h=3B74C57CC521D8900F45

AnswerRe: RCF::RecvTimeoutExceptionmemberJarl Lindrud23 Jun '06 - 0:24 

Hi,
 
It sounds like you want to explicitly kill a server thread, which is not really a good idea. In general there's only 1 thread in the server, answering client requests one at a time, so if you kill it, the server will no longer respond to any client requests.
 
If you're bent on doing it, though, the operating system API has functions for killing threads, any of those would do.
 
BTW, there is a new and improved version of this framework, here.[^]
 
Regards,
Jarl.

Generalboost dependencymemberHua Zhong26 Apr '06 - 12:05 
Hi Jarl,
 
I was looking for a lightweight RPC library for C++ and found your page. This looks like a very nice interface and attracted me immediately.
 
However, it seems to rely on boost 1.33.0. I have two questions:
 
1. Are you planning to make it independent of boost? How much effort would that be? (I could probably help a bit if it's not too much of work)
 
2. Or are you planning to make it compatible with boost 1.33.1 (or whatever the latest version is)? I tried to build it with 1.33.1 and it complains about missing files (test/minimal.hpp, read_write_mutext.hpp, etc)
 
Thanks.
 
Hua
GeneralRe: boost dependencymemberJarl Lindrud27 Apr '06 - 2:02 

Hi Hua,
 
Sorry, I didn't realize there were any problems compiling with boost 1.33.1, I'll put together an update and post it here. The code is meant to work with any of the newer versions of boost.
 
As for making RCF independent of Boost, that has so far not been a high priority for me Smile | :) I've used Boost pretty extensively thoughout RCF, and eliminating it would be a lot of work, with questionable results, IMHO.
 
Finally, I should point out that I'm no longer actively maintaining this version of RCF; there is a newer version available here:
 
http://www.codeproject.com/threads/Rcf_Ipc_For_Cpp.asp[^]
 
It has all the features of this version, with a lot of extra things as well (encryption, compression, publish/susbcribe, interface inheritance, etc.)
 
Regards,
 
Jarl.

GeneralThanksmembermattavila13 Mar '06 - 6:56 
Jarl,
 
I just wanted to put in a good word for your project. I am using the C++ RMI framework for a project and found the overall setup very nice. We are using the framework to glue a Matlab application to binary data base. Writing/modification of the Matlab client ".mex" was the most challenging part. We did have to up the maximum message size from the original 1024*50 to support our needs.
 
Cheers,
Matt
GeneralRe: ThanksmemberJarl Lindrud15 Mar '06 - 0:42 

Good to hear, thanks for the info!
 
/Jarl.

GeneralNewing up client proxy ObjectsmemberJimWalters4 Feb '06 - 5:19 
Hi,
 
I read your article. Good work. Haven't looked thru the source yet.
 
Could this code be used to "new up" proxy objects on the client side that mapped to concrete objects on the server. Example - a video server, where there is a server class CTwoDObject with a bunch of methods. I want to be able to create proxy object representations on the client side and have the server create concrete objects, then be able to invoke methods on these objects and have your code handle the messaging between the client-server.
 
Right now, I have this working currently by having each method Send a command to pass a message to the server (each object is identified with a unique handle). It is rather cumbersome as each method has a SendCommand and/or ReceiveReply. Also, the server has to have something similar.
 
Could you give an example of your code doing something similar?
 
thanks for any info.
 
Jim
GeneralRe: Newing up client proxy ObjectsmemberJarl Lindrud5 Feb '06 - 14:55 

Hi Jim,
 
Have you looked at the updated version of RCF here[^]?
 
Have a look at the ObjectFactoryService class, it lets clients create objects on the server and then call methods on them. There's a short example in the article, if you have any questions about it just ask.
 
Regards,
Jarl.

Generalgeneral questionsmemberchrhol2 Feb '06 - 5:00 
First I must point out that it's a good-looking library, definitely the cleanest interface for remote invokation around.=)
 
However, I have some questions which I could't find any answer to when I first looked at your library, but that was quite a while ago and maybe things have changed since.
 
As a user I want to be able to use a transport layer of my choice, and not be bound to the default tcp implementation. Can this be done?
 
Can I bind application specific data to a client connection on the server side?
 
Can I make asynchrounous calls from the client?
 
Can I feed the server and client with raw input and it'll decode and invoke the content?
 

 
Regards,
Christian

GeneralRe: general questionsmemberJarl Lindrud5 Feb '06 - 15:13 

Hi Christian,
 
I've made quite a few changes to RCF over the last 6 months, but they're on a different branch than this version, you can find the new version here[^]. I'll answer your questions based on that version:
 
chrhol wrote:
As a user I want to be able to use a transport layer of my choice, and not be bound to the default tcp implementation. Can this be done?

 
The transport layer is now separated from the rest of RCF (it wasn't before), so you can write your own; I've written server and client transports for TCP and UDP, you can check them out to see how it works.
 
chrhol wrote:
Can I bind application specific data to a client connection on the server side?

 
Not right now, but it should be easy for me to add, I'll add it to the list of things to implement for the next release. What you can do at the moment is to let clients create objects on the server, using ObjectFactoryService, and have the client-specific data in those objects. They're not tied to the physical connection though.
 
chrhol wrote:
Can I make asynchrounous calls from the client?

 
Besides the usual two-way request/response way of making a call, you can also make one-way calls; the client sends a message to the server, but then doesn't hang around for a reply, and in fact the server never sends one either. Proper asynchronous calls are currently not implemented, ie where you're informed at a later point in time that a call has completed.
 

chrhol wrote:
Can I feed the server and client with raw input and it'll decode and invoke the content?

 
Not implemented, but that probably wouldn't be hard to setup. In what scenario would you be using it?
 
Regards,
Jarl.
 

 

 

 

GeneralRe: general questionsmemberchrhol8 Feb '06 - 0:17 
Hi Jarl,
Thanks for the replies, much appreciated! From now on I will follow your development on the library where it's updated, so I do not need to ask questions that I can find out for myself Wink | ;)
 

Jarl Lindrud wrote:
chrhol wrote:
Can I feed the server and client with raw input and it'll decode and invoke the content?
 

 
Not implemented, but that probably wouldn't be hard to setup. In what scenario would you be using it?

 
For tunnelling your RCF protocol over an already established connection where I want to mix protocols from different systems. If I oversimplify, I would like to do something like this:
 
enum protocol
{
system_0,
system_1,
..
rcf_1
}
 
struct net_packet
{
protocol proto;
std::pair data;
security_descriptor &security;
}
 
void server_invoke(net_packet &p)
{
if(p.proto == rcf_1)
{
rcf_server.invoke(p.data.first, p.data.second, p.security.get_rcf_client_connection());
}
else
{
...
}
}

 
It's a bit rough, I agree, but hopefully I showed my point anyway Smile | :)
 
Regards,
Christian

GeneralRe: general questionsmemberJarl Lindrud8 Feb '06 - 11:51 

chrhol wrote:
For tunnelling your RCF protocol over an already established connection where I want to mix protocols from different systems. If I oversimplify, I would like to do something like this:

 
OK I see, that would be useful. I'll put it on the list of things to do. Might be a little while before I get around to dealing with it though, I'm a bit occupied at the moment getting RCF to run on Unix, but after that Smile | :)
 
Jarl.

Questionhow to make in solarismembernetboy_16816 Jan '06 - 16:16 
I tried to make demo in solaris for many times,but failed.Can you tell how to make demo in solaris ,please give me your Makefile,Thanks.
AnswerRe: how to make in solarismemberJarl Lindrud16 Jan '06 - 19:11 

It's been a while since I built RCF on solaris, but I used bjam, from Boost, to build it, instead of a makefile. I can use the same jamfile to build things on Windows/Linux/Solaris, with just about any compiler, and I find it a lot simpler than using makefiles.
 
It shouldn't make any difference, though, which build tool you're using. Which version of which compiler are you using? What errors are you getting? Compiler errors or linker errors?
 
Regards,
Jarl.

GeneralRe: how to make in solarismembernetboy_16817 Jan '06 - 2:39 
first ,thanks for reply in time.
 
my step as follws
 
1. using qmake create Makefile
 
#############################################################################
# Makefile for building: Client
# Generated by qmake (1.07a) (Qt 3.3.4) on: Tue Jan 17 20:59:31 2006
# Project: Client.pro
# Template: app
# Command: $(QMAKE) -o Makefile Client.pro
#############################################################################
 
####### Compiler, tools and options
 
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
CFLAGS = -pipe -Wall -W -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT
CXXFLAGS = -pipe -Wall -W -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -DRCF_NO_BOOST_SERIALIZATION
LEXFLAGS =
YACCFLAGS= -d
INCPATH = -I/usr/lib/qt-3.3/mkspecs/default -I. -I. -I$(QTDIR)/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
AR = ar cqs
RANLIB =
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
QMAKE = qmake
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE= $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE= $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
 
####### Output directory
 
OBJECTS_DIR = ./
 
####### Files
 
HEADERS =
SOURCES = Client.cpp \
..\MyService.hpp \
..\RCF\RCF.cpp \
..\SF\SF.cpp
OBJECTS = Client.o \
MyService.o \
RCF.o \
SF.o
FORMS =
UICDECLS =
UICIMPLS =
SRCMOC =
OBJMOC =
DIST = Client.pro
QMAKE_TARGET = Client
DESTDIR =
TARGET = Client
 
first: all
####### Implicit rules
 
.SUFFIXES: .c .o .cpp .cc .cxx .C
 
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
 
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
 
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
 
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
 
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
 
####### Build rules
 
all: Makefile $(TARGET)
 
$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)
 
mocables: $(SRCMOC)
uicables: $(UICDECLS) $(UICIMPLS)
 
$(MOC):
( cd $(QTDIR)/src/moc && $(MAKE) )
 
Makefile: Client.pro /usr/lib/qt-3.3/mkspecs/default/qmake.conf /usr/lib/qt-3.3/lib/libqt-mt.prl
$(QMAKE) -o Makefile Client.pro
qmake:
@$(QMAKE) -o Makefile Client.pro
 
dist:
@mkdir -p .tmp/Client && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/Client/ && ( cd `dirname .tmp/Client` && $(TAR) Client.tar Client && $(GZIP) Client.tar ) && $(MOVE) `dirname .tmp/Client`/Client.tar.gz . && $(DEL_FILE) -r .tmp/Client
 
mocclean:
 
uiclean:
 
yaccclean:
lexclean:
clean:
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
 

####### Sub-libraries
 
distclean: clean
-$(DEL_FILE) $(TARGET) $(TARGET)
 

FORCE:
 
####### Compile
 
Client.o: Client.cpp ../MyService.hpp
 
MyService.o: ..\MyService.hpp
$(CC) -c $(CFLAGS) $(INCPATH) -o MyService.o ..\MyService.hpp
 
RCF.o: ..\RCF\RCF.cpp ../RCF/ClientStub.cpp \
../RCF/Connection.cpp \
../RCF/Exception.cpp \
../RCF/InitDeinit.cpp \
../RCF/MethodInvocation.cpp \
../RCF/Multiplexer.cpp \
../RCF/Protocol/Protocol.cpp \
../RCF/Random.cpp \
../RCF/RcfServer.cpp \
../RCF/Token.cpp \
../RCF/Tools.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o RCF.o ..\RCF\RCF.cpp
 
SF.o: ..\SF\SF.cpp ../SF/Archive.cpp \
../SF/DataPtr.cpp \
../SF/deque.cpp \
../SF/Encoding.cpp \
../SF/Exception.cpp \
../SF/I_Stream.cpp \
../SF/ITextStream.cpp \
../SF/IBinaryStream.cpp \
../SF/INativeBinaryStream.cpp \
../SF/list.cpp \
../SF/map.cpp \
../SF/memory.cpp \
../SF/Node.cpp \
../SF/OBinaryStream.cpp \
../SF/ONativeBinaryStream.cpp \
../SF/OTextStream.cpp \
../SF/PortableTypes.cpp \
../SF/Registry.cpp \
../SF/scoped_ptr.cpp \
../SF/SerializeSmartPtr.cpp \
../SF/SerializeStl.cpp \
../SF/SerializeStaticArray.cpp \
../SF/SerializeDynamicArray.cpp \
../SF/SerializeFundamental.cpp \
../SF/SerializePolymorphic.cpp \
../SF/Serializer.cpp \
../SF/set.cpp \
../SF/SfNew.cpp \
../SF/shared_ptr.cpp \
../SF/Stream.cpp \
../SF/string.cpp \
../SF/Tools.cpp \
../SF/vector.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o SF.o ..\SF\SF.cpp
 
####### Install
 
install:
 
uninstall:
 
2. execute make and got such errors
 
make
make: *** No rule to make target `..\MyService.hpp', needed by `MyService.o'. Stop.
 
3. gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)
 
can you tell me how to use bjam to build demo and show me you jamfile,thanks.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 6 Aug 2009
Article Copyright 2005 by Jarl Lindrud
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid