dce/rpc "client" api
elrond at samba.org
Fri Aug 18 08:33:54 GMT 2000
On Fri, Aug 18, 2000 at 12:11:12AM -0500, Peter Samuelson wrote:
> > I think the void* return value is the only way to generically pass
> > back information from the functions unless they all share a state
> > information for representing a connection.
> void* is horrible for documentation and readability, unfortunately. It
> gives no clue as to what is supposed to be behind the pointer. Yes,
> it's supposed to be opaque, but you could still typedef it:
> typedef void* rpcconnstate;
The other way is the one, that Gtk+ uses. It's a nice
thing. (At least I like it).
/* This is a pointer to the function table */
/* other basic stuff */
/* reference count.
* refer to the file docs/refcounting.txt on this issue.
typedef struct _GtkObject GtkObject;
(next one modified to show stuff)
void (* changed) (GtkAdjustment *adjustment);
void (* value_changed) (GtkAdjustment *adjustment);
I think, this is one of the nicest ways of doing OO in C.
Gtk+ also has a lot of tools to do the Casts and verify the
casts are done in the right way (casting a GtkAdjustment to
a GtkObject is fine, the other way round gets you a big
So what I would propose:
There's only one public function for each transport, the
connect function, it returns a pointer to a struct, that
mainly contains a pointer to your function table
You can then have a nice wrapper
void cli_connection_free(cli_rpc_info *con)
Just another way of doing it.
More information about the samba-technical