Garrett Wollman said:
struct timezone; // Opaque structure typedef struct timezone timezone_t; // Opaque typedef
Not at all. That typedef is not opaque, it is entirely transparent, and simply resolves to an incomplete structure. Consider the following two-line compilation unit:
struct timezone *foo; // Compiles fine... timezone_t foo; // Syntax error!
Not a syntax error, a declaration error. Try: clive@finch-staff-1> cat xx.c struct timezone; typedef struct timezone timezone_t; struct timezone s; struct timezone *sp; extern struct timezone es; extern struct timezone *esp; timezone_t t; timezone_t *tp; extern timezone_t et; extern timezone_t *etp; clive@finch-staff-1> cc xx.c xx.c:4: storage size of `s' isn't known xx.c:8: storage size of `t' isn't known clive@finch-staff-1> Nothing to do with typedef or not, just to do with the rules for declarations.
You *are* using public and private headers, aren't you ? That is, users of your library include <timezone.h>
No, users of my library include <foo.h>. It defines some interfaces which take a timezone parameter.
So in foo.h write the one line: typedef struct timezone timezone_t; End of story. -- Clive D.W. Feather | Work: <clive@demon.net> | Tel: +44 20 8371 1138 Internet Expert | Home: <clive@davros.org> | Fax: +44 20 8371 1037 Demon Internet | WWW: http://www.davros.org | DFax: +44 20 8371 4037 Thus plc | | Mobile: +44 7973 377646