socklen_t usage in gcrypt.h

Simon Josefsson jas at
Sat Jan 22 00:29:52 CET 2005

Albert Chin <gcrypt-devel at> writes:

> gcrypt assumes socklen_t exists on the system. This is not the case
> for Solaris 2.6, HP-UX 10.20, and Tru64 UNIX 4.0D. Should I modify
> gcrypt.h accordingly or should callers be expected to provide a
> socklen_t equivalent?

IMHO, since socklen_t is POSIX, callers should provide an equivalent.

I do that successfully in several projects using this snippet (I
sometime use 'int' instead of 'size_t'):

AC_CHECK_TYPE([socklen_t],, [AC_DEFINE([socklen_t], [size_t],
              [Define to `size_t' if `socklen_t' is missing.])], [
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

Hope this helps,

More information about the Gcrypt-devel mailing list