Opened 12 years ago

Closed 12 years ago

#18440 closed defect (fixed)

libiconv: iconv() function prototype differences

Reported by: ryandesign (Ryan Schmidt) Owned by: ryandesign (Ryan Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.7.0
Keywords: Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port: libiconv

Description

libiconv defines the second parameter of the iconv function differently on different operating systems. Specifically libiconv tries to mimic the behavior of the system's iconv, whatever that may be. The author of libiconv appears to intend this behavior.

However libiconv in MacPorts seems to have some peculiarities of its own in how and when that function's definition changes.

In ${prefix}/include/iconv.h we see the different definitions of the iconv function.

MacBook Pro Core 2 Duo, Tiger
libiconv @1.12_2 (non-universal):

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

MacBook Pro Core 2 Duo, Tiger
libiconv @1.12_2+darwin_8+universal (4-arch) before r46078 / using MacPorts built-in universal variant:

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

MacBook Pro Core 2 Duo, Tiger
libiconv @1.12_2+universal (4-arch) after r46078 / using muniversal portgroup:

#ifndef __LP64__
extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
#else /* __LP64__ */
extern size_t iconv (iconv_t cd,  char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
#endif /* __LP64__ */

I'm not certain why the function is different on 32-bit an 64-bit.

Change History (5)

comment:1 Changed 12 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: mcalhoun@… added

Cc Me!

comment:2 Changed 12 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Do the differences between the config.log in i386 and x86_64 give any indication why the prototypes are different between the 32 and 64 bit builds?

comment:3 Changed 12 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

The reason for this seems to be that the libiconv library is not 32/64-bit universal on Tiger.

$ file /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libiconv.dylib 
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libiconv.dylib: Mach-O universal binary with 2 architectures
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libiconv.dylib (for architecture ppc):	Mach-O dynamically linked shared library stub ppc
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libiconv.dylib (for architecture i386):	Mach-O dynamically linked shared library stub i386

As far as the configure scripts is concerned, libiconv is not installed, so it defaults to "char* * inbuf".

This behavior is easy to override.
Any thoughts on which convention we should choose?

comment:4 Changed 12 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

comment:5 Changed 12 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: newclosed

Fixed in r50387.

Note: See TracTickets for help on using tickets.