Subject: Re: bin/12017: how to enable multibyte locale (and problem around it)
To: None < (NetBSD GNATS submissions and>
From: None <>
List: netbsd-bugs
Date: 01/22/2001 08:35:34
>> 	this is partly because multibyte locale support uses dlopen() from
>> 	within libc.  it is unavoidable for extensibility and smaller code
>> 	footprint.
>> 	(if we avoid use of dlopen(), we will have locale library that is not
>> 	future-proven, and netbsd binaries will become bigger due to unused
>> 	locale handling code.  in the document we don't consider it an option)
>Somebody had better think of making it an option VERY soon (i.e.
>avoiding the use of dlopen() in static binaries for any purpose)!!!!!

	if "no dlopen call in libc" is our consensus, that's just fine with me.
	soda looked not fine with it though :-)

	if you permit us this, i believe it simpler to enable multibyte code.
	patch to do this is attached.

	drawback is that you will have all locale handling code linked into
	your static library, once you use printf().  printf pulls in mbrtowc,
	and it will pull in EUC/UTF2/UTF8/whatever handling code as a result.
	if we want a option to compile a binary with no locale support,
	we may want to ship libnolocale.a or whatever to override locale code.
	(i don't know what is the common practice for this.  i remember
	freebsd shipped multibyte locale in libxpg4, however it looked bogus
	and was not a standard practice)

	this is the size comparison after "strip".  since ifconfig calls printf,
	it pulls in EUC/UTF2/whatever handling code.
-r-xr-xr-x  1 root  wheel   238640 Jan 21 16:21 ifconfig.withdllocale
-rwxr-xr-x  1 root  itojun  251580 Jan 22 08:29 ifconfig.withstaticlocale

	(i guess similar discussion will be raised when we integrate iconv(3)
	into our libc...)


Index: locale/
RCS file: /cvsroot/basesrc/lib/libc/locale/,v
retrieving revision 1.31
diff -u -r1.31
--- locale/	2000/12/27 00:57:03	1.31
+++ locale/	2001/01/21 23:30:59
@@ -26,7 +26,7 @@
 #		-D_PATH_LOCALEMODULE=\"/usr/lib/runemodule\"
 # to be dynamically loaded
-#SRCS+=	big5.c euc.c euctw.c iso2022.c mskanji.c utf2.c utf8.c
+SRCS+=	big5.c euc.c euctw.c iso2022.c mskanji.c utf2.c utf8.c
 MAN+=	iswalnum.3 towlower.3
Index: locale/setrunelocale.c
RCS file: /cvsroot/basesrc/lib/libc/locale/setrunelocale.c,v
retrieving revision 1.7
diff -u -r1.7 setrunelocale.c
--- locale/setrunelocale.c	2001/01/03 15:23:26	1.7
+++ locale/setrunelocale.c	2001/01/21 23:31:01
@@ -472,7 +472,6 @@
 		return ret;
-#if 0
 	else if (!strcmp(rl->__encoding, "EUC"))
 		ret = _EUC_init(rl);
 	else if (!strcmp(rl->__encoding, "BIG5"))
@@ -491,7 +490,6 @@
 		ret = _UTF8_init(rl);
 	else if (!strcmp(rl->__encoding, "EUCTW"))
 		ret = _EUCTW_init(rl);
 		ret = EINVAL;