Sorting it all Out Michael Kaplan's random stuff of dubious value Be sure to read the disclaimer here first!
People often look at the Microsoft Layer for Unicode (MSLU) and wonder how they could avoid shipping an extra file.
Recently, Hans Hansen posted a message to the microsoft.public.platformsdk.mslayerforunicode, asking the question in the following way:
Hello!On http://msdn.microsoft.com/msdnmag/issues/01/10/MSLU/default.aspx it is described how you can link MSLU into your program. But according to this page, the program will then depend on the unicows.dll file on the Windows 9x platforms. Is it possible to instead statically link wit MSLU so that this dll is not required? I have been doing some googleing and there seems to be different opinions on this issue.\ I use Microsoft Visual Studio .NET 2003. My program is a plain C++ program and I do not use ATL or MFC. Best, Hans
Hello!On http://msdn.microsoft.com/msdnmag/issues/01/10/MSLU/default.aspx it is described how you can link MSLU into your program. But according to this page, the program will then depend on the unicows.dll file on the Windows 9x platforms. Is it possible to instead statically link wit MSLU so that this dll is not required?
I have been doing some googleing and there seems to be different opinions on this issue.\
I use Microsoft Visual Studio .NET 2003. My program is a plain C++ program and I do not use ATL or MFC.
Best,
Hans
Unfortunately, the answer is that this option is not available -- you have to ship the DLL if you are running on Win9x.
The obvious question that people ask at that point is why things were designed this way.
Although to be frank, I can never tell when people asking if it is out of genuine curiousity or if it is to try to find a flaw in the reasoning that would convince me to change the whole direction of the project and give them exactly what they want. I always assume that the answer is the (usually mature) former rather than the (usually immature) latter, although I am probably underestimating the childish nature that developers often have (I am including myself here when I talk about that, since I still feel like a developer no matter what my title is).
Remember that the #1 performance goal was to not hurt the performance of applications running on NT-based platforms. This only makes sense since the project was being done primarily at the behest of a developer in the Windows Division and the payment for the project was approved by a Windows Vice President. Shipping something that would help encourage migration off Win9x or at least to take the best possible advantage of NT-specific features is a good thing, shipping something that slows down the platform even a little is not.
But the DLL itself does add some performance considerations. While it is itself loaded with a "delay load type" functionality, once it is actually loaded it does not itself "delay load" all of its own dependants. Thus loading UnicoWS.dll in a process will load a bunch of DLLs. There is a hit that only happens if you load the DLL, so if its full functionality was included in a .LIB, a lot of extra work would have had to happen to make sure that performance on NT-based platforms was not adversely affected.
It would also mean adding a whole bunch of code to your application binary that is simply never used on NT-based platforms. Now it would not mean adding the full size of the DLL to every project, but it would mean adding however much you are using in the way of APIs.
Now admittedly neither of these problems is unsolvable, but I learned a long time ago that successful software projects are based on focused and targetted goals and visions. Which does not work well with the idea of trying to solve every puzzle and fix every problem even if the problems are not part of the core scenario you are trying to address. I suspect that had the focus of MSLU been as unfocused as all that, it would have either never shipped or it would have been a year later and with a lot more bloat. And it may not have even been terribly usable after everything was said and done.
Which is not to say that a bit of undisciplined havoc never sneaks in (for example, think about the support for resource updating. Or the work to make sure that even those who do try to use UnicoWS.dll on NT-based platfoms will still see the calls forwarded to the OS).
But if you keep your primary project goals in mind, then the occasional diversion will not kill you. Or the project. Or the people who are doing the triage on features. The key is to not waste too much time or effort on items that are outside the scope of the project.
Which in this case (unfortunately) included the "never ship an extra file, even on Win9x platforms" feature....
This post brought to you by "ڇ" (U+0687, ARABIC LETTER TCHEHEH)