[Top][All Lists]

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

Re: Public header files

From: Jef Driesen
Subject: Re: Public header files
Date: Tue, 02 Mar 2010 22:03:35 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100217 Lightning/1.0pre Shredder/3.0.3pre

On 01/03/10 19:35, Ralf Wildenhues wrote:
Hello Jef,

* Jef Driesen wrote on Mon, Mar 01, 2010 at 01:33:46PM CET:
How do I get information generated by autotools into my public
header files? For instance I want to define version numbers
somewhere in my file, and have the same numbers appear
in a public header file without having to modify both files
manually? Another example is that my library needs a 64bit integer
type for its public api.

Since a config.h header files is not supposed to be public, that's
not an option. But how can I do this correctly?

Use a second config header.  Its input template will not be generated by
autoheader; you write it yourself.  That way you can be sure to only put
safe stuff in there.

Can you give me some info to guide me into the right direction. I don't know where or what I should be looking for.

As much as possible, try to think of the possibility that your users may
enable or disable presence of a 64bit integer with compiler command line
options they pass to their package's configure script, or want a
multilib-like installation, where they adjust --libdir for different
ABI versions of your package; you should strive to have as few variation
in public headers as possible, ideally both versions install the same
header files (and only differ in semantics through preprocessor means).

For the 64bit integer, I am using the preprocessor right now:

#ifdef _WIN32
typedef __int64 ticks_t;
typedef long long int ticks_t;

It works fine for every system I have access too, but long long is not standard and thus not guaranteed to be present. So I just want to make sure it will work on other systems too.

An alternative of the above approach is the AX_PREFIX_CONFIG_H macro
from the Autoconf Macro Archive.

I'll have a look at that too.

reply via email to

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