iconv.h file and structures

This section describes the iconv.h file and it's structures.

The iconv.h file in /usr/include defines the following structures:

typedef struct __iconv_rec   iconv_rec, *iconv_t;
struct __iconv_rec   {
    _LC_object_t  hdr;
    iconv_t (*open)(const char *tocode, const char *fromcode);
    size_t (*exec)(iconv_t cd, char **inbuf, size_t *inbytesleft,
            char **outbuf, size_t *outbytesleft);
    void  (*close)(iconv_t cd);
};

The common core structure is as follows (/usr/include/iconv.h):

typedef struct _LC_core_iconv_type      _LC_core_iconv_t;
struct _LC_core_iconv_type {
        _LC_object_t  hdr;
        /* implementation initialization */
        _LC_core_iconv_t        *(*init)();
        size_t  (*exec)();
        void    (*close)();
};

Every converter has a static memory area, which contains the _LC_core_iconv_t structure. It is initialized in the instantiate subroutine provided as part of the converter program.