Development Tools for OS/2 for the PowerPC

From EDM2
Jump to: navigation, search

by Robert Spinneweber

The Developer's Toolkit for OS/2 for the PowerPC contains cross-development tools that run under OS/2 (on an Intel machine) and generate code that executes under OS/2 for the PowerPC. These include:

  1. MultiRes Resource Compiler (MRES)
  2. MultiLib Library Utility (MLIB)
  3. Remote IBM Presentation Manager Debugger (IPMD)

In this article, I will explain how you can modify your current OS/2 development environment so that you can begin porting your applications to run on OS/2 for the PowerPC.

MultiRes Resource Compiler

The MultiRes Resource Compiler (MRES) replaces RC.EXE. It is an application development tool that provides a mechanism to add application resources to your executable files MRES uses a resource script file as input and generates an ELF object file that can be linked with your executable.

RC to MRES Conversion Table
RC MRES
-r N/A
-i<include path> -I<include path>
-d<define>=<value> -M<define>=<value>
-d<define> -M<define>=1
-p -k
-x N/A
-x1 N/A
-x2 N/A
-cc cc -U Ccc
-cp cp / lb,tb,... -U Kcp lb,tb,...
-h -?

The major difference between MRES and RC is that MRES does not bind binary resource files to your executable. Instead, it generates an ELF object file that can be linked to your executable.

MRES uses the following command line syntax:

mres <options> -- input rc,output res,input res,output obj

The -- separator signals the end of the command line options and the beginning of the files to be processed. For example:

mres -I x  ibmsdkb h -- input rc,,,output obj

MultiLib Library Utility

The MultiLib Library Utility (MLIB) replaces LIB.EXE and IMPLIB.EXE. You can use MLIB to create libraries from object files and other libraries. You can also use it to add, copy, delete, extract, and replace elements in a library, as follows:

  • To add an element to a library:
-A<file type>,<filespec>[+<filespec>]

where <file type> is one of the following

o - for an object file
f - for a module definition file
d - for a dynamic link library (DLL)
l - for a library

You cannot add an element to a library if it is already present in the library. Either use the replace option (-R), or delete the element and then add it.

  • To copy an element from a library:
-K<filespec>[+<filespec>]

The copy command extracts an element from the specified library without removing it from the library.

  • To delete an element from a library:
-D<filespec>[+<filespec>]

The delete command removes an element from the library.

  • To extract an element from a library:
-E<filespec>[+<filespec>]   

The extract command deletes an element from the library.

  • To replace an element in a library:
-R<filespec>[+<filespec>]

You can also use MLIB to generate import libraries from either module definition files or dynamic link libraries (DLLs). If you are using MLIB to create libraries that will be used with the MetaWare Linker, you must use the -X AR option to specify the UNIX AR format.

For example, to generate an import library called IMPORT.LIB from the module definition file EXPORTS.DEF using IMPLIB, you would issue the following command:

implib import.lib exports.def

With MLIB, the command would be:

mlib -X AR -Af,exports.def -- import.lib

(where -X AR specifies the AR format, and -Af adds a module definition file.)

When adding module definition files to an import library, make sure the import library does not already contain the module definition file. If it does, MLIB will generate an error message and the module definition file will not be replaced MLIB can process your existing valid module definition files without modification.

To generate an import library called IMPORT.LIB from a DLL, you would issue the following command:

implib import.lib user.dll

With MLIB, the command would be:

mlib -X AR -Ad,user.dll -- import.lib

Remote IBM Presentation Manager Debugger

The Remote IBM Presentation Manager Debugger (IPMD) is a debugging tool that assists in the detection and diagnosis of errors in source code. With IPMD, you can set breakpoints, monitor variables and registers, and view the call stack information. If you are familiar with IPMD for OS/2, using Remote IPMD for debugging OS/2 for the PowerPC executables will be an easy transition.

In order to use Remote IPMD for symbolic debugging, you will need to specify the -g option on the command line if you are using the MetaWare compiler and tools. For more information on compiling and linking your programs, refer to the MetaWare documentation included with the MetaWare compiler.

Before you can use the debugger, you must set the following environment variables:

  • MYBINDIR - Identifies the directory on the OS/2 machine where the debug binary exists. Note that this is a single directory and not a list of directories.
  • MYSISERVER - Identifies the IP address of the PowerPC and the IPMD port number. Specify this variable as IP address:port number. Note that these numbers must match those specified in the BOOT.CFG file on the PowerPC.
  • PMDPATH - Path where the source code resides on the OS/2 machine. Note that MYBINDIR is searched before PMDPATH.
  • MYCOMTYPE - Identifies the communication protocol to be used by IPMD. The valid values are TCP, ASYN, and UDP.MYCOMTYPE is UDP by default.
  • MYLAUNCHINFO - Identifies the personality of the program being debugged and the location of the executable on the PowerPC. Specify this variable as personality:location. For example:
SET MYBINDIR=x:\BINARY\DIRECTORY
SET MYSISERVER=1.1.1.1:6000
SET PMDPATH=x:\SOURCE\DIRECTORY1;x:\SOURCE\DIRECTORY2
SET MYCOMTYPE=UDP
SET MYLAUNCHINFO=WPOS:C:\;WPOS:C:\TEST

Conclusion

In addition to the tools described in this article, you will also find other useful programs and utilities to help in your development of OS/2 for the PowerPC, including:

  • The Universal Resource Editor (URE), which replaces the Dialog Editor
  • ELFSTRIP, which can be used to strip debug information from your OS/2 for the PowerPC executable before it is transferred to the PowerPC

The tools found in the "Developer Tools for OS/2 for the PowerPC" category will simplify your PowerPC development efforts.

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation