bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installing gnulib headers with project


From: Bruno Haible
Subject: Re: Installing gnulib headers with project
Date: Fri, 05 Jan 2018 15:04:38 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-101-generic; KDE/5.18.0; x86_64; ; )

> I do implement a purely functional API with my project. A gl_list_t is
> never used by the user
> and is instead wrapped inside of a structure defined by me. All API
> functions operate on said
> data structure instead of using a gl_list_t structure.

Good, fine.

> My problem is that the header file in which this data type is defined
> includes gl_list.h.  When I try
> removing this include statement, the gl_list_t type is undeclared and
> throws and error.

There are at least two ways to solve it:

a) Put the declaration of the data type in a private header file.
   E.g. foo.h:
           struct foo;
           int bar (struct foo *);
        foo-private.h:
           #include <foo.h>
           #include "gl_list.h"
           struct foo { ...; gl_list_t member; ... };

b) Use 'struct gl_list_impl *' instead of gl_list_t, since that what it really
   is.
   E.g. foo.h:
           struct gl_list_impl;
           struct foo { ...; struct gl_list_impl * member; ... };
           int bar (struct foo *);
        foo-private.h:
           #include <foo.h>
           #include "gl_list.h"

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]