Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!mtune!lznv!mark From: mark@lznv.ATT.COM (MARK SMITH) Newsgroups: comp.lang.c++ Subject: Virtual Functions in IPC environment Message-ID: <1120@lznv.ATT.COM> Date: Mon, 31-Aug-87 16:24:22 EDT Article-I.D.: lznv.1120 Posted: Mon Aug 31 16:24:22 1987 Date-Received: Fri, 4-Sep-87 07:18:25 EDT Organization: AT&T ISL Middletown NJ USA Lines: 33 I am building a message-based system consisting of client/server processes which I would like to implement using C++. As such, for a given message I would like to define the base class class MsgHdr { IPC private data items; public: IPC access functions(); }; and a set of derived classes class DerivedN: public MsgHdr { private data for DerivedN; public: virtual void Operate(); // server: do DerivedN-specific fct }; However, I encounter two difficulties: (1) Although the intention is clearly to allow Operate() only to be usable by the server, I can't find a way to disallow a client process from linking with Operate. Since I am memory-conscious (I'm using swapping UNIX), this is a critical fault. (2) Similarly, the client can't send a DerivedN and expect Operate to work, since the server gets a DerivedN Operate linked in the address space of the client. Memory fault core dumped. Is there some better abstraction? I came up with some ugly (more C-like) workarounds involving run-time virtual function linking (for (1)) and readdressing (for (2)). Shared libraries are out, too. I'm beginning to believe there's no advantage in using C++ objects if they are to be passed across process boundaries. Mark Smith --- { all that jazz } ! lznv ! mark