home *** CD-ROM | disk | FTP | other *** search
- ******************************************************************************
- * SAMPLE PROGRAM 04: READ.ME *
- * *
- * COPYRIGHT: *
- * ---------- *
- * Copyright (C) International Business Machines Corp., 1991,1992. *
- * *
- * DISCLAIMER OF WARRANTIES: *
- * ------------------------- *
- * The following [enclosed] code is sample code created by IBM *
- * Corporation. This sample code is not part of any standard IBM product *
- * and is provided to you solely for the purpose of assisting you in the *
- * development of your applications. The code is provided "AS IS", *
- * without warranty of any kind. IBM shall not be liable for any damages *
- * arising out of your use of the sample code, even if they have been *
- * advised of the possibility of such damages. *
- * *
- ******************************************************************************
-
- This sample program shows how to call 16-bit routines from a 32-bit
- program. The 16-bit routines are placed in two DLLs. One of these is bound
- to the EXE at load time, by using IMPLIB to build an import library. The
- other is bound at run-time, by using the DosLoadModule/DosQueryProcAddr
- APIs.
-
- The intent of this sample is to show how to call 16-bit routines for which
- the source is not available, or which has not yet been converted to 32-bit.
- The routines in XYZZY16.DLL have the source given for example purposes, but
- the mechanisms used to call the routines easily generalise to cases where
- the source is not available.
-
- The routines plugh1() and plugh2() are straightforward examples of how to
- call 16-bit routines directly. plugh1() sets a global variable shared
- between the 16-bit and 32-bit routines. plugh2() sets a pointer which is
- passed as a parameter.
-
- plugh3() shows how to do a 16->32 callback, a technique which is
- necessary when a user function is to be passed to a 16-bit routine with
- the intent that the user function will then be called from the 16-bit
- routine. This technique is used, for example, with Communications
- Manager and Lan Services. The user-supplied routine is declared using
- a 16-bit calling convention, but the routine is actaully run as a 32-bit
- task.
-
- plugh4() shows how to dynamically load a routine at run time. It uses
- OS/2 APIs to load a DLL and to query the address of the function which
- it wishes to call. It calls this routine through the function pointer
- returned by OS/2.
-
- When this program is run, it should print out the first four lines of
- Blake's _Jerusalem_.
-
- The build procedure assumes that you have a 16-bit compiler installed on your
- machine, with all the necessary INCLUDE and LIB paths setup properly.