Migrating Windows Applications to OS/2: Making it Work

From EDM2
Jump to: navigation, search

by Jeff English
One Up Corporation

Migrating Windows source code to OS/2 is doable! It is, however, an involved process that requires knowledge of both the Windows and OS/2 environments, as well as the many differences in the APIs. The right set of tools can make the porting process easier.

With the increasing success of OS/2, it is becoming paramount to many application developers to have native applications on multiple platforms. For many, this means migrating their existing Windows application source to OS/2. Cross-platform conversion of source code is a doable, albeit time-consuming process.

Windows to OS/2 Porting - The Programming Perspective

Both Windows and OS/2 are message-based environments. However, the formats of these messages, as well as the APIs, differ substantially between the two. To solve the porting problem, one must handle those areas that do not overlap.

There are also some conceptual differences in how things operate. For example, Windows relies on the concepts of brushes and pens for many of its drawing primitives. OS/2 relies on the concepts of bundles and attributes. A line bundle defines the drawing attributes and an area or image bundle defines the fill attributes. A conceptual difference such as this can significantly alter the logic of the application when ported to OS/2.

The following is a list of some of the most common major issues:

  • Conversion from 16- to 32-bit application code
  • Preemptive multitasking
  • Multiple Document Interface (MDI)
  • GDI (Windows) vs. GPI (OS/2)
  • Printing and Device Driver dependencies
  • Window class styles and use of the class device context
  • Message notification and message order dependencies
  • Resource and data sharing among instances of an application or DLL
  • Conversion from 16-bit segmented memory model to 32-bit flat memory model
  • OLE support

How much the application exploits and depends on these items will affect how easy the migration will be. Separating these features into platform dependent objects is one solution to reducing the effort of porting.

Porting Tools

Many tools are available today that assist in some of the phases of the porting process. Tools, such as GREP and Seek-and-Scan, can help identify individual features in the source. Basic text editors can perform simple replacement of text. More sophisticated editors, such as SourceLink, provide hyper-link access for source replacement.

A suite of tools developed by One Up Corporation and currently being enhanced and expanded, greatly assist the migration process in all phases of the porting process.

Summary

Porting of source code is much more than attempting to map APIs from one platform to another. The port can become more difficult if the source code includes features that must be redesigned on the target platform. However, with the a complete understand ing of both the Windows and OS/2 programming environments and right tools, this process can be much easier.