Being native Windows and OS/2

12 May 2017

Lost in the chaos of the IBM-Microsoft seperation was something I always considered to be a technical gem, called Windows Libraries for OS/2, or WLO.

To set context for the time: OS/2 2.0 supported 32 bit applications and could run a version of Windows in order to support Windows applications. This was possible because being 32 bit, it could emulate multiple DOS sessions concurrently with arbitrary memory arrangements, allowing Windows to be launched with as much memory as desired.

OS/2 1.x had a more difficult problem. Being 16 bit, and only allocating a single 640Kb DOS session, it had no practical way to execute Windows to run Windows software. Using OS/2 in its graphical form really required graphical OS/2 software. But since even at the time there was more graphical software for Windows than OS/2, the obvious path was porting Windows software. What WLO allowed was emulating the Windows API as part of a native OS/2 application.

Okay, why is this special? This type of thing is done all the time, right? Yes. But what makes WLO unique is that it exploited the way 16-bit OS/2 and 16-bit Windows both used the same executable format, so it could trick OS/2 into loading a Windows application on OS/2, then provide the necessary libraries so that the Windows API was all there. The result is a true, native OS/2 application that could call into the rest of OS/2 as needed.

But what it also means is that the binary still runs, unmodified, as a Windows application. The same binary was simultaneously natively OS/2 and natively Windows.

This was a little disingenuous though. Every NE executable has a field indicating which platform it's for - one value for OS/2, one value for Windows. So how does the executable run on both? Technically it's marked as a Windows application with an extra flag that indicates, "oh, by the way, I also run on OS/2." It's much easier to build a cross platform shim when you can change the loader of the target platform to make the shim work.

The real applications this was used for, Word and Excel, were just marked as OS/2 applications. Because these used prerelease versions of WLO, it's doubtful that they could have functioned cleanly on Windows, and it wasn't the intention anyway. Below are the DLLs distributed with Excel, including the core Windows DLLs from the time with a _B suffix:

I don't know if the development kit for it was ever released. In addition to Word and Excel, there were some demonstration Windows 3.0 applets, but that's all I saw it used for. The documentation claimed that all that was needed was a re-link; I'm somewhat skeptical about that claim since running on OS/2 might want a more enlightened CRT than the Windows/DOS version. But it's clearly true that the porting involved was not large.