Re: how to deal with shared parameters for multiple programs?

Erik Sjölund <[email protected]> Sun, 2 Jan 2011 17:21:44 +0100
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
Hi Lorenzo,

> I think a possible solution is to allow a .ggo file to include another on=
e,
> which is something is still to be implemented in gengetopt...

Yes, I read about the plans. Before that is being implemented it is
always possible to use
cmake or some other tool to generate out the .ggo files.

> however, this would have the same semantics of C include, and would only
> copy the contents of the included .ggo file.
>
> implementation of such include feature would be quite easy...
>
> otherwise, that include, in order to have what you need, should have a
> semantics similar to C++ inheritance which is not possible in C...
>
> or, as you suggest, to have pointer to the common struct... that semantic=
s
> of include would require a more involved implementation though... =A0I gu=
ess
> at least...

You understood me perfectly.

> do you have other ideas?

Not really.

> Note, however, that the generated struct passed to the generated parser i=
s
> not thought to be used by other functions... =A0but only to collect comma=
nd
> line arguments and values... =A0those values are better to be copied into=
 your
> own variables

Yes, you are probably right. I think I will use my own struct instead.
If I for instance later want to publish an open source library, there
better be no dependencies on gengetopt in the functions of the library.

cheers,
Erik