From WxWiki
Jump to navigation Jump to search

Unicode works on Windows 2000, XP, Vista and so on, not on Windows 95, 98 and ME. You might think that you would have to build two versions of your program, one for Windows 9x/ME and another for the newer operating systems. But by using the Microsoft Layer for Unicode (MSLU) you can build one Unicode version and run it on Windows 9x/ME as well on 2000, XP, Vista etc. Just load the runtime library, unicows.dll or link to unicows.lib. The latter procedure is given in the Integrating MSLU section of MSLU: Develop Unicode Applications for Windows 9x Platforms with the Microsoft Layer for Unicode and in the Compiling Your Application with the Microsoft Layer for Unicode page of the Microsoft Platform SDK documentation. The Microsoft Platform SDK package contains the unicows.lib file.

Usually MSLU works like this:

  • libunicows.a - The program source has to link (not with wx-read below) to a small static library MSLU-loader (libcows). It has to be the first library linked (edit makefile etc). Download for MinGW (and MSVC?) libunicows loader .a
  • unicows.dll - The libcows runtime dll must be in the same directory as the program. (Download from Microsoft support page.)

With wxWidgets the first item is not needed. There is no need to link the .a from libunicows/opencows/etc. because wxWidgets provides its own libcows loader. Do not link libunicows by hand when using wxWidgets. You still need to get the .dll runtime from Microsoft support page.

Works With

  • MSVC
  • MinGW crosscompile (from linux to win32)
  • MinGW win32

Using MSLU

  • Enable MSLU support (--enable-mslu in configure of source code of wxWidgets library)
  • If the enable failed or when on a platform without configure (such as Microsoft Studio Visual C++), do it manually by editing include/wx/msw/setup.h (which is your localized version of setup0.h) and enable MSLU with #define wxUSE_UNICODE_MSLU 1. Verify that wxUSE_UNICODE is enabled as well.
  • The code responsible for verifying the loading of MSLU is in src/msw/main.cpp at about line 234. Search for the wxIsUnicodeAvailable function. The error messages you might receive when your application is started are generated error here.
  • make / build
  • Install.
  • Install the libs. (In the example, copy dlls to the correct directory.)
  • Change the lib range in your project: first /nod:xxx.lib for all win-libs, then unicows.lib, then win-libs and last wx-libs. (Example: /nod:kernel.lib /nod:user32.lib /nod:gdi32.lib unicows.lib kernel32.lib user32.lib gdi32.lib wxmsw28u_core.lib wxbase28u.lib)
  • Rebuild your program.
  • Make sure it uses the correct dlls.
  • Get the unicows.dll redistributable file from Microsoft's support page and put it in the directory of program.
  • Now it should work on both Window 9x/ME and all later Windows operating systems.

More Information