Quote:
>Here is what I understand what I have to do:
>On the client:
>Call a RPC-C-Function from within a member of one of my objects.
>That means, the the RPC-C-functions have to be visible (scope)
>to my objects.
Yes.
Quote:
>On the server:
>Call the member of one of my objects from within a RPC-C-function.
>That means, the objects I create have to be visible (scope)
>to the RPC-C-functions.
Yes.
Quote:
>How can I accomplish this ?
See below.
Quote:
>I suppose I have to rename the RPC-C-stub-files to .CPP-files ?!
No.
Okay The catch is that the objects on the server and the objects on the client
are not one and the same.
You should have a client-side class and a server-side class. I hope this is
clear, I am afraid I really
can't explain it without blathering on for pages .. bottomline remember the
reason you are using
object orientation in the first place.
Pseudo Code :
The midl compiler that compiles the idl file creates a idl_file.h
// MyServer.h
class MyServer
{
int RealFunc( int x ); // this is the real function that does the real
work, and runs on the server
Quote:
};
// RPC_FUNC.h
int REALmy_rpc_func( int x );
// RPC_FUNC.cpp
#include "idl_file.h"
#include "RPC_FUNC.h"
#include "MyServer.h"
int REALmy_rpc_func( int x )
{
// may be using a global instance of object, or a global list of objects,
// or maybe object passed as parameter ... here I just declare local
instance
MyServer object;
return object.RealFunc(x);
Quote:
}
All the above files are compiled and linked into the server exe that runs on
the server machine.
All the below files are compiled and linked into the client exe that runs on
the client machine.
// MyClient.h
class MyClient
{
void do_something();
// client specific stuff
Quote:
};
// MyClient.cpp
#include "MyClient.h"
#include "idl_file.h"
void MyClient::do_something()
{
// stuff here ...
// make call to server
result = my_rpc_func(25); // note my_rpc_func declared in idl_file.h by midl
compiler versus REALmy_rpc_func
// which is the real rpc
function that gets called on the server machine
// do more stuff here
Quote:
}
Hope this helps ... Dave