home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / COMPILER / SAMPLE04 / SAMPLE04.H < prev   
C/C++ Source or Header  |  1995-06-29  |  2KB  |  59 lines

  1. /******************************************************************************/
  2. /* SAMPLE PROGRAM 04: SAMPLE04.H                                              */
  3. /*                                                                            */
  4. /* DISCLAIMER OF WARRANTIES:                                                  */
  5. /* -------------------------                                                  */
  6. /* The following [enclosed] code is sample code created by IBM                */
  7. /* Corporation.  This sample code is not part of any standard IBM product     */
  8. /* and is provided to you solely for the purpose of assisting you in the      */
  9. /* development of your applications.  The code is provided "AS IS",           */
  10. /* without warranty of any kind.  IBM shall not be liable for any damages     */
  11. /* arising out of your use of the sample code, even if they have been         */
  12. /* advised of the possibility of such damages.                                */
  13. /*                                                                            */
  14. /******************************************************************************/
  15.  
  16. #ifndef __32BIT__
  17.   /*
  18.    * In 16-bit mode, remap the 32-bit-specific keywords to their 16-bit
  19.    * equivalents.  This allows this header file to be shared by both the
  20.    * 16-bit and 32-bit files.
  21.    */
  22.   #define _Seg16
  23.   #define _Far16
  24.   #define _Cdecl _cdecl
  25.   #define _Pascal _pascal
  26.   #define _Fastcall _fastcall
  27.   /*
  28.    * Define extern to be blank.  This means that all global variables will
  29.    * be "owned" by the 16-bit routine.
  30.    */
  31.   #define extern
  32. #endif
  33.  
  34. /*
  35.  * Global variables.  foo1 will be shared by the 32-bit EXE and the 16-bit
  36.  * DLL.  It is "owned" by the DLL.  The #pragma map directive causes foo1
  37.  * to be known externally as _foo1.  We do this because the 16-bit compiler
  38.  * prepends an underscore to all external names, and the 32-bit code and the
  39.  * 16-bit code have to agree on the name of the variable which is being
  40.  * shared.
  41.  */
  42.  
  43. extern char * _Seg16 foo1;
  44.  
  45. #ifdef __32BIT__
  46.   #pragma map( foo1, "_foo1" )
  47. #endif
  48.  
  49.  
  50. /*
  51.  * Prototypes.  The C Set/2-specific keywords have been translated to their
  52.  * 16-bit equivalents for 16-bit compiles by the #defines above.
  53.  */
  54.  
  55. extern void _Far16 _Cdecl     plugh1( void );
  56. extern void _Far16 _Pascal    plugh2( char * _Seg16 * );
  57. extern void _Far16 _Cdecl     plugh3( void (* _Far16 _Pascal)( void ) );
  58.  
  59.