[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Non-standard types in public header files (was: Re: ssize_t)
From: |
Simon Josefsson |
Subject: |
Non-standard types in public header files (was: Re: ssize_t) |
Date: |
Fri, 12 Aug 2005 14:34:17 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
I realized I couldn't use the ssize_t module directly in GnuTLS.
GnuTLS uses ssize_t in its public header file, so it has this in
configure.ac:
AC_CHECK_TYPE(ssize_t,
DEFINE_SSIZE_T="#include <sys/types.h>"
AC_SUBST(DEFINE_SSIZE_T)
,
AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
DEFINE_SSIZE_T="typedef int ssize_t;"
AC_SUBST(DEFINE_SSIZE_T)
,[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
])
and this in gnutls.h.in:
/* Get ssize_t. */
#ifndef HAVE_SSIZE_T
# define HAVE_SSIZE_T
@DEFINE_SSIZE_T@
#endif
While I appreciate ideas on how to solve this particular problem,
there is a more generic problem here:
I have a similar problem in several packages; in particular for the
?int*_t types.
The gnulib module "stdint" enable applications to use those types
(which I haven't done because it is GPL and my packages are mostly
LGPL...). However, the module doesn't help if the types are used in
the public API.
I have been successfully using this complex M4 macro:
http://ac-archive.sourceforge.net/guidod/ax_create_stdint_h.html
It create a "foo-int.h" file that I can install on the system, and
that my public header file can include.
Would it be possible to either transform the existing stdint module in
gnulib, or write a new module, that can also support something like
this macro? Or are there other ideas?
The problem, of course, is that the installed header file cannot
assume a config.h and the HAVE_* stuff. It should simply work.
A naive implementation of this idea would only work with the same
compiler as the one used when building the package. Guido's complex
script supposedly handle this, and the generated foo-int.h should
produce correct types by any compilers on the same host (e.g., you can
use both a 32-bit and a 64-bit compiler with the same header file).
I talked with Guido about this earlier, and he seemed positive about
using his stuff in gnulib, although I didn't ask about copyright
assignments.
Thanks.
- ssize_t, Simon Josefsson, 2005/08/12
- Re: ssize_t, Bruno Haible, 2005/08/12
- Re: ssize_t, Simon Josefsson, 2005/08/12
- Re: [bug-gnulib] Non-standard types in public header files (was: Re: ssize_t), Bruno Haible, 2005/08/12
- Re: Non-standard types in public header files, Simon Josefsson, 2005/08/12
- Re: Non-standard types in public header files, Albert Chin, 2005/08/13
- Re: Non-standard types in public header files, Simon Josefsson, 2005/08/15
- Re: Non-standard types in public header files, Stepan Kasal, 2005/08/25
Re: ssize_t, Karl Berry, 2005/08/12