Skip to Content.
Sympa Menu

freetds - [freetds] iconv identifier redefinition, iconv plug mode

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Isak Johnsson <isak AT hypergene.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] iconv identifier redefinition, iconv plug mode
  • Date: Tue, 6 Apr 2004 22:15:05 +0200

Hello!

I've run into the iconv problems you touched upon a while ago (https://lists.ibiblio.org/sympa/arc/freetds/2004q1/015433.html). I've digged a little bit more into it, maybe this can be of some help...

Out of the box, it doesn't work...

$ cd freetds-0.63.dev.20040405
$ ./configure --enable-msdblib --with-iodbc=/ --with-tdsver=8.0
$ make
gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -D_FREETDS_LIBRARY_SOURCE -I/usr/local/include -DIODBC -DMSDBLIB -D_REENTRANT -D_THREAD_SAFE -DDEBUG=1 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -g -O2 -MT token.lo -MD -MP -MF .deps/token.Tpo -c token.c -fno-common -DPIC -o .libs/token.o
token.c: In function `tds7_get_data_info':
token.c:1426: error: structure has no member named `libiconv'


The cause is apparently these lines in the system iconv.h file:

#ifndef LIBICONV_PLUG
#define iconv libiconv
#endif
extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);


This can be used to work around the compilation problem:

$ export CFLAGS=-DLIBICONV_PLUG
$ ./configure --enable-msdblib --with-iodbc=/ --with-tdsver=8.0
$ make


...but it doesn't feel like the "right" way... The iconv homepage says this:

This library can be built and installed in two variants:
• The library mode. This works on all systems, and uses a library libiconv.so and a header file <iconv.h>. (Both are installed through "make install".)
...
• The libc plug/override mode. This works on GNU/Linux, Solaris and OSF/1 systems only.
It is a way to get good iconv support without having glibc-2.1. It installs a library
libiconv_plug.so. This library can be used with LD_PRELOAD, to override the
iconv* functions present in the C library.


To me, it sounds like the first method is the way to go. But the workaround above seemingly uses the second, or maybe a mix of the two.


It looks quite dangerous to redefine the identifier 'iconv' in the header file, as they are doing, but I guess there is some thought behind it. Can FreeTDS take some action to remedy this? Such as undef-ing iconv right after the include directive, or using another name for the member...

BTW, how come this have stopped working? It must have been working once?

Isak




  • [freetds] iconv identifier redefinition, iconv plug mode, Isak Johnsson, 04/06/2004

Archive powered by MHonArc 2.6.24.

Top of Page