Subject: Re: iconv(3) prototype
To: None <tech-userlevel@NetBSD.org>
From: T.SHIOZAKI <tshiozak@netbsd.org>
List: tech-userlevel
Date: 08/04/2004 05:38:23
> > > Not to start anything, but fwiw GNU defines theirs as const, too.  And
> > 
> > Really? Quoting from /usr/include/iconv.h :
> > 
> > extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
> >                      size_t *__restrict __inbytesleft,
> >                      char **__restrict __outbuf,
> >                      size_t *__restrict __outbytesleft);
> > (this is on Debian 3.0 - Woody, glibc-2.2.5-6).

GNU libiconv and GNU libc are mutually independent.


> I was going by what I'm using in pkgsrc:
> 
> $ pkg_info libiconv |grep ^Info; grep ^extern /usr/pkg/include/iconv.h
> |grep inbytes
> 
> Information for libiconv-1.9.1nb2:
> extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft,
> char* * outbuf, size_t *outbytesleft);

This is generated from libiconv-1.9.1/include/iconv.h.in:

extern size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);

It seems that:

(A) @ICONV_CONST@ follows the system's iconv.h if it exists, or
(B) @ICONV_CONST@ is empty (non-const) by default.

--
Takuya SHIOZAKI