bug-gnulib
[Top][All Lists]
Advanced

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

Re: question about correct usage of gnulib


From: Lorenzo Bettini
Subject: Re: question about correct usage of gnulib
Date: Wed, 11 May 2011 09:21:02 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10

On 05/03/2011 11:57 PM, Bruno Haible wrote:
Lorenzo Bettini asked:
Would it be correct to put config.h only say in file1.cpp (and use the
ā€˜-Iā€™ option that refers to the Gnulib library directory for that file
only), and not in file2.cpp and file3.cpp (where I don't use -I to refer
to gnulib library directory), and then link all the 3 files together by
also putting -lgnu?
...
what about libraries?
For instance, I can live with including config.h in all .cpp library
files, but I wouldn't add it to library header files.  Header files are
not referring to any struct defined in system header files of gnulib...
at least I guess (basically my library header files only use string form
C++ standard library)...  would that be safe?

As long as your header files refer only to types that are not replaced by
gnulib or autoconf macros, and these types are compiler independent, you're
safe.

The most critical types in this respect are those provided by<stdint.h>  and
<stdbool.h>. If you want header files that can be consumed by any compiler
(e.g. build on Solaris with gcc, and allow the user to use cc on Solaris,
or vice versa), then you need to play some tricks that are not included in
gnulib. libunistring does it like this, with a reduced stdint.h replacement
and a (currently buggy) stdbool.h replacement.

But if you use 'string' from the C++ standard library, then your users are
tied to the compiler (and precise compiler version) you use anyway. In this
case, you can also simply publish the generated stdint.h and stdbool.h
(under different names, or in subdirectories of $(includedir), of course!!).
Also don't forget to sed-replace the double-inclusion guard of these generated
files.

Hi Bruno

actually I see that in the build directory (in the subdirectory where gnulib headers are generated) there's no stdint.h and stdbool.h, so I should be OK, right?

thanks in advance
        Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com





reply via email to

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