Getnameinfo name changes between glibc versions, how can I map it?

I need to match the signature for the getnameinfo call so that I can write a wrapper around this call. Unfortunately, the signature changes between hosts.

Everything worked and continued until I tried to compile the latest CentOS, 6.3, which gives an error:

error: conflicting types for 'getnameinfo' 

AND?

It turns out that the last argument, flags, is designated as an unsigned int on CentOS (glibc-headers-2.12-1.80), but it's just an int on Fedora (glibc-headers-2.15-58). (Note that the manual pages on both hosts say it should be int.)

extern int getnameinfo ( /*cut*/, unsigned int __flags);

against

extern int getnameinfo ( /*cut*/, int __flags);

Some searches lead me to think that the standard has changed the type of the flags argument.

, . ? autoconf ? , (gcc) - , , .

+5
1

__GLIBC_MINOR__, features.h, , :

#include <features.h>

#if __GLIBC_MINOR__ > 12 
    getnameinfo(..., flags);
#else 
    getnameinfo(..., (unsigned) flags);
#endif
+3

All Articles