home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / samples / sam04l / samp04a.c__ / SAMP04A.C
Encoding:
C/C++ Source or Header  |  1992-04-01  |  2.3 KB  |  57 lines

  1. /******************************************************************************/
  2. /* SAMPLE PROGRAM 04: SAMP04A.C                                               */
  3. /*                                                                            */
  4. /* COPYRIGHT:                                                                 */
  5. /* ----------                                                                 */
  6. /* Copyright (C) International Business Machines Corp., 1991,1992.            */
  7. /*                                                                            */
  8. /* DISCLAIMER OF WARRANTIES:                                                  */
  9. /* -------------------------                                                  */
  10. /* The following [enclosed] code is sample code created by IBM                */
  11. /* Corporation.  This sample code is not part of any standard IBM product     */
  12. /* and is provided to you solely for the purpose of assisting you in the      */
  13. /* development of your applications.  The code is provided "AS IS",           */
  14. /* without warranty of any kind.  IBM shall not be liable for any damages     */
  15. /* arising out of your use of the sample code, even if they have been         */
  16. /* advised of the possibility of such damages.                                */
  17. /*                                                                            */
  18. /******************************************************************************/
  19.  
  20. /*
  21.  * The 16-bit routines.  These are put into a DLL which is bound to the 32-bit
  22.  * EXE at load time.
  23.  */
  24.  
  25. #include "sample04.h"
  26.  
  27. /*
  28.  * Set the global variable foo1 to point at the first string.
  29.  */
  30.  
  31. void plugh1( void ) {
  32.   foo1 = "And did those feet in ancient time";
  33.   return;
  34. }
  35.  
  36. /*
  37.  * Take a pointer to a pointer as an address, and point that pointer at the
  38.  * second string.
  39.  */
  40.  
  41. void _pascal plugh2( char ** ptr ) {
  42.   *ptr = "Walk upon England's mountains green.";
  43.   return;
  44. }
  45.  
  46. /*
  47.  * Print the third string by calling a 32-bit routine which has a 16-bit
  48.  * entry sequence.  We get the address of this routine passed in as a function
  49.  * pointer.  We have to make the call to the 32-bit routine indirectly
  50.  * becuase it is not currently possible to call 32-bit routines directly.
  51.  */
  52.  
  53. void _cdecl plugh3( void (* _pascal fn)( void ) ) {
  54.   fn();
  55.   return;
  56. }
  57.