home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / somltype.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-26  |  5.2 KB  |  159 lines

  1. /*
  2.  *   COMPONENT_NAME: somk
  3.  *
  4.  *   ORIGINS: 27
  5.  *
  6.  *
  7.  *   10H9767, 10H9769  (C) COPYRIGHT International Business Machines Corp. 1992,1994
  8.  *   All Rights Reserved
  9.  *   Licensed Materials - Property of IBM
  10.  *   US Government Users Restricted Rights - Use, duplication or
  11.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12.   Last change:  KAS  12 Oct 94    3:44 pm
  13.  */
  14. /* %Z% %I% %W% %G% %U% [%H% %T%] */
  15.  
  16. /*
  17.  */
  18.  
  19. /*
  20.  *    SOMLTYPE.H
  21.  *    Assure definitions for SOMEXTERN, SOMLINK, and SOMDLINK
  22.  *
  23.  *    These variables are used to control the register linkage conventions
  24.  *    for all SOM functions, methods, and external data references.  
  25.  *
  26.  *    All SOM functions and external data references are preceeded with a
  27.  *    SOMEXTERN macro (SOM methods do not have external names).
  28.  *
  29.  *    All SOM functions and methods are prototyped with a SOMLINK keyword.
  30.  *
  31.  *    All SOM external data references are defined with a SOMDLINK keyword.
  32.  *
  33.  *    Users may supply (at their own risk) appropriate definitions for
  34.  *    other compilers using "-DSOMEXTERN=x", "-DSOMLINK=y" or "-DSOMDLINK=z"
  35.  *    arguments on the compiler's command line.  Any such definition is not
  36.  *    disturbed by the following code.
  37.  *  
  38.  *    assumptions: 
  39.  *      (1) __cplusplus is defined when compiling C++ code anywhere
  40.  *      (2) __IBMCPP__ is defined by CSet/2 on OS/2 when compiling C++ code
  41.  *      (3) _CL386 may be defined if not using an IBM compiler
  42.  *      (4) neither _CL386 nor __IBMCPP__ are defined on AIX
  43.  *
  44.  *    assumption (2) is not properly stated.
  45.  *
  46.  *      (new 2) __IBMCPP__ is defined by IBM C++ compilers for all platforms,
  47.  *              including _WIN32, therefore, you must check which system is
  48.  *              targeted in these blocks.
  49.  *
  50.  *      _WIN32 also means that a new macro is present.  This macro is
  51.  *      called WIN32_DLLIMPORT.  It is used to deal with the with the
  52.  *      MSVC __declspec(dllimport) syntax (or equivalent syntax for other
  53.  *      vendors) required for global data imported from DLLs.  It appears
  54.  *      on the ClassData structure definitions in .h and .xh bindings,
  55.  *      most of the time.  It does not appear in some situations.  For
  56.  *      example, consider class Foo.  If the .h was included by Foo's
  57.  *      implementation file, or if the macro SOM_DONT_IMPORT_Foo_Class
  58.  *      is defined, then the ClassData struct does not have WIN32_DLLIMPORT
  59.  *      in the data declaration.  Examine binding files for more detail.
  60.  *      You may override this macro from the command line at your own
  61.  *      risk.
  62.  */
  63.  
  64. /* set up the use of import syntax on WINDOWS NT/95 platforms */
  65. #if defined(_WIN32) && !defined(WIN32_DLLIMPORT)
  66.     /* Microsoft compiler defines */
  67.     #if (_MSC_VER >= 900)
  68.       #define WIN32_DLLIMPORT __declspec(dllimport)
  69.     #elif (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__WINDOWS__)
  70.       /* IBM compiler defines */
  71.       #define WIN32_DLLIMPORT __declspec(dllimport)
  72.     #endif
  73.  
  74.     /* DEFAULT: no defines from above means define it to NULL/nothing */
  75.     #if !defined(WIN32_DLLIMPORT)
  76.       #define WIN32_DLLIMPORT
  77.     #endif
  78. #endif
  79.  
  80. /* TORO57113: defined WIN32_DLLEXPORT as well */
  81. #if defined(_WIN32) && !defined(WIN32_DLLEXPORT)
  82.     /* Microsoft compiler defines */
  83.     #if (_MSC_VER >= 900)
  84.       #define WIN32_DLLEXPORT __declspec(dllexport)
  85.     #elif (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__WINDOWS__)
  86.       /* IBM compiler defines */
  87.       #define WIN32_DLLEXPORT __declspec(dllexport)
  88.     #endif
  89.  
  90.     /* DEFAULT: no defines from above means define it to NULL/nothing */
  91.     #if !defined(WIN32_DLLEXPORT)
  92.       #define WIN32_DLLEXPORT
  93.     #endif
  94. #endif
  95.  
  96. #ifndef SOMEXTERN
  97.   #ifdef __cplusplus
  98.     #define SOMEXTERN extern "C"
  99.     #ifdef __STR__
  100.       #undef __STR__
  101.     #endif
  102.   #else
  103.     #define SOMEXTERN extern
  104.   #endif
  105. #endif
  106.  
  107. #ifndef SOMLINK
  108.   #if defined(_CL386)
  109.     #define SOMLINK _syscall
  110.   #elif defined(__OS2__)
  111.     #if defined(__IBMCPP__) || defined(__IBMC__)  /* 15369 */
  112.       #define SOMLINK _System
  113.     #elif defined(__BCPLUSPLUS__) || (__BORLANDC__)
  114.       #define SOMLINK _syscall
  115.     #elif defined(__HIGHC__)
  116.       #define SOMLINK _DCC(_DEFAULT_CALLING_CONVENTION &   \
  117.                ~_SHORT_STRUCTS_IN_REGS & ~_OVERLOADED)
  118.     #else
  119.       #define SOMLINK
  120.     #endif
  121.   #elif defined(__WINDOWS__)   /* 15369 */
  122.     #define SOMLINK __stdcall  
  123.   #elif defined(_MSDOS) || defined(__MSDOS__) || defined(__SC__)
  124.     #if defined(_WDOS) || defined(__SOMEMIT__)
  125.       #ifdef __SC__
  126.     #define SOMLINK
  127.       #endif
  128.     #else
  129.       #define SOMLINK __loadds
  130.       #define WIN16_SOMLINK __loadds
  131.       #ifndef _WIN16
  132.   #define _WIN16
  133.       #endif
  134.     #endif
  135.   #elif defined(_WIN32)
  136.     #define SOMLINK __stdcall
  137.   #else
  138.     #define SOMLINK
  139.   #endif
  140. #endif
  141.  
  142. #ifndef SOMDLINK
  143.   #if defined(_CL386)
  144.     #define SOMDLINK
  145.   #elif defined(__OS2__)
  146.     #define SOMDLINK
  147.   #elif defined(_MSDOS) || defined(__MSDOS__) || defined(__SC__)
  148.     #if (defined(_WDOS) || defined(__SOMEMIT__)) && defined(__SC__)
  149.       #define SOMDLINK
  150.     #else
  151.       #define SOMDLINK __far
  152.     #endif
  153.   #else
  154.     /* this is also the WIN32 define */ 
  155.     #define SOMDLINK
  156.   #endif
  157. #endif
  158.  
  159.