-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 1.4.0
-
Component/s: core-libs
-
mantis
-
x86
-
windows_nt
I want to include this header file in a Windows native data transfer file so
that I can map CF_LOCALE clipboard data to a Java text encoding. However, I'm
concerned about the way this file is structured. Because you have defined these
data structures in a header file, each .obj file gets its own copy of these
structures. It would be more efficient to declare these structures extern (and
non-static) in the .h file, define them in a single .c file, and link against
the library which contains the structures when necessary.
The attached test cases show demonstrate the inefficiency. Modify the batch
files to point to a directory which contains locale_str.h. build_locale_1.bat
builds and links a single object file which is empty except for the data
structures in locale_str.h. build_locale_2.bat builds and links two separate
object files, each of which is empty except for the same data structures. The
extra data is enough to increase the size of the DLL by one 4K segment.
L:\bugs\4397482>build_locale_1
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
LocaleTest_1.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
L:\bugs\4397482>dir LocaleTest.dll
Volume in drive L is local
Volume Serial Number is 8BA6-04F6
Directory of L:\bugs\4397482
04/27/2001 12:31p 20,480 LocaleTest.dll
1 File(s) 20,480 bytes
0 Dir(s) 13,906,214,912 bytes free
L:\bugs\4397482>build_locale_2
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
LocaleTest_1.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
LocaleTest_2.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
L:\bugs\4397482>dir LocaleTest.dll
Volume in drive L is local
Volume Serial Number is 8BA6-04F6
Directory of L:\bugs\4397482
04/27/2001 12:31p 24,576 LocaleTest.dll
1 File(s) 24,576 bytes
0 Dir(s) 13,906,214,912 bytes free
L:\bugs\4397482>
that I can map CF_LOCALE clipboard data to a Java text encoding. However, I'm
concerned about the way this file is structured. Because you have defined these
data structures in a header file, each .obj file gets its own copy of these
structures. It would be more efficient to declare these structures extern (and
non-static) in the .h file, define them in a single .c file, and link against
the library which contains the structures when necessary.
The attached test cases show demonstrate the inefficiency. Modify the batch
files to point to a directory which contains locale_str.h. build_locale_1.bat
builds and links a single object file which is empty except for the data
structures in locale_str.h. build_locale_2.bat builds and links two separate
object files, each of which is empty except for the same data structures. The
extra data is enough to increase the size of the DLL by one 4K segment.
L:\bugs\4397482>build_locale_1
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
LocaleTest_1.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
L:\bugs\4397482>dir LocaleTest.dll
Volume in drive L is local
Volume Serial Number is 8BA6-04F6
Directory of L:\bugs\4397482
04/27/2001 12:31p 20,480 LocaleTest.dll
1 File(s) 20,480 bytes
0 Dir(s) 13,906,214,912 bytes free
L:\bugs\4397482>build_locale_2
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
LocaleTest_1.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
LocaleTest_2.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
L:\bugs\4397482>dir LocaleTest.dll
Volume in drive L is local
Volume Serial Number is 8BA6-04F6
Directory of L:\bugs\4397482
04/27/2001 12:31p 24,576 LocaleTest.dll
1 File(s) 24,576 bytes
0 Dir(s) 13,906,214,912 bytes free
L:\bugs\4397482>