A dilemma with handles
Mark Delany
markd at iti.org
Wed Oct 3 00:14:09 AEST 1990
A bit of a dilemma that I'd like some advise on please.
I'm currently developing a portable library that provides a high-quality
link across async lines.
The interface is purposely similar to stdio/Unix-IO in that you have
routines like zzopen, zzwrite, zzread, etc.
As an example, the major call sequences are:
handle = zzopen(...);
bytes = zzwrite(handle, ...);
bytes = zzread(handle, ...);
result = zzclose(handle);
I'm sure you get the drift.
Now my question relates to the definition of "handle". Within the
library this is simply a pointer to a structure that holds all the
goodies necessary to achieve the results.
Unfortunately, this structure is quite complicated and littered with
system dependencies. Complications and system dependencies that I don't
want visible in the caller's environment. Hopefully the reasons are
obvious for this, but in case they're not, the structure has a variety
of #ifdef's for all the Unix variants which I don't want the user to
have to define correctly prior to use.
In other words, because the real definitions of "handle" is full of
system dependencies, I want to define a *dummy* "handle" for the
purposes of the user's view of the library - especially considering
prototypes.
To finally get to my question.
Is the idea of defining a dummy definition acceptable or should I burden
the user with the full definition?
If a dummy definition *is* acceptable, then presumably I should define
it as "void *". Yes, no?
--
------------ ----------------- ---------------------
Mark Delany markd at Aus.Sun.COM ...!sun!sunchat!markd
------------ ----------------- ---------------------
More information about the Comp.lang.c
mailing list