You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Compliant Solution

In the first compilation module, which is included by the user, the abstract data type is declared as a pointer to a struct. The struct is declared as an incomplete type.

struct string_mx;

typedef struct string_mx *string_m;

In the "private" compilation unit struct string_mx is fully defined but non-visible to a user of the API.

union str_union_t {
	char *cstr;
	wchar_t *wstr;
};

struct string_mx {
    size_t size; 
    size_t maxsize; 
    unsigned char strtype;

    union str_union_t charset; 
    union str_union_t str; 
};
  • No labels