/*
 *    @(#) 1.11 src/somk/intel_nt/somplatf.h, somk.api, som3.0 9/4/96 13:53:08 [12/22/96 21:51:13]
 */

/*
 * 96F8647, 96F8648, 96F8850 (C) Copyright IBM Corp. 1992, 1994
 * All Rights Reserved
 * Licensed Materials - Property of IBM
 */

/*
 *    SOMPLATF.H
 *
 *    Plaform-specific portions of the SOM ABI
 *
 *    Interfaces and typedefs described in this header vary across
 *    platforms.
 *
 */

#ifndef somplatf_h
#define somplatf_h


/*
 * Class Libraries -- Loading and Class Registration
 *
 * This section defines the system-dependent library handle that is
 * passed as an argument to somRegisterLibraryClasses and the
 * userInitTermRoutine.  For OS/2, this is an HMODULE (unsigned long);
 * for AIX, it is a function pointer (void *) for the main entry point
 * of the library.
 */

typedef unsigned long somLibraryHandle;

/*
 *    This portion was moved from SOMDEFS.H  (formerly SOMLTYPE.H)
 *    Set up the compiler-dependent macro definitions needed by the SOM
 *    header files.  The macro variables defined here are SOMEXTERN,
 *    SOMLINK, SOMDLINK, SOM_DATASEG_PRAGMAS, SOMLEGACY1, SOMLEGACY2
 *
 *    The SOMEXTERN, SOMLINK, and SOMDLINK variables are used to control
 *    the register linkage conventions for all SOM functions, methods,
 *    and external data references.
 *
 *    All SOM functions and external data references are preceded with a
 *    SOMEXTERN macro (SOM methods do not have external names).
 *
 *    All SOM functions and methods are prototyped with a SOMLINK keyword.
 *
 *    All SOM external data references are defined with a SOMDLINK keyword.
 *
 *    The SOM_DATASEG_PRAGMAS variable controls whether or not
 *    #pragma data_seg(segname) directives are passed to the compiler.
 *    This variable is defined only for compilers that recognize and
 *    implement this pragma.  SOM's support for coerced classes makes
 *    use of this pragma to place certain data definitions in specific
 *    data segments.
 *
 *    Users may supply (at their own risk) appropriate definitions for
 *    other compilers using "-DSOMEXTERN=x", "-DSOMLINK=y", "-DSOMDLINK=z",
 *    or "-DSOM_DATASEG_PRAGMAS" arguments on the compiler's command line.
 *    Any such definition is not disturbed by the following code.
 *
 *    assumptions:
 *      (1) __cplusplus is defined when compiling C++ code anywhere
 *      (2) __IBMCPP__ is defined by CSet/2 on OS/2 when compiling C++ code
 *      (3) __IBMC__ is defined by CSet/2 on OS/2 when compiling C code
 *      (4) _CL386 may be defined if not using an IBM compiler
 *      (5) neither _CL386 nor __IBMCPP__ are defined on AIX
 *      (6) the SOMLINK keyword has replaced the use of "#pragma Linkage"
 *          directives in previous releases of SOM
 */

/*
 * These definitions are used to select legacy support in
 * our source code. When this header file is ported to other
 * platforms, consideration should be given to the degree of
 * legacy support that is necessary. The file somobj.idl defines
 * similar support.
 */

#define SOMLEGACY1 /* support obsolete apsects of SOM 1.0 */
#define SOMLEGACY2 /* support obsolete apsects of SOM 2.0 */


#ifndef SOMEXTERN
  #ifdef __cplusplus
    #define SOMEXTERN extern "C"
    #ifdef __STR__
      #undef __STR__
    #endif
  #else
    #define SOMEXTERN extern
  #endif
#endif

#ifndef SOMLINK
  #if defined(__IBMCPP__) || defined(__IBMC__)
    #define SOMLINK __stdcall
  #elif defined(__BCPLUSPLUS__) || defined(__BORLANDC__)
    #define SOMLINK __stdcall
  #elif defined(__HIGHC__)
    #define SOMLINK _DCC(_DEFAULT_CALLING_CONVENTION &   \
                         ~_SHORT_STRUCTS_IN_REGS & ~_OVERLOADED)
  #else
    #define SOMLINK __stdcall
  #endif
#endif

#ifndef SOMDLINK
  #define SOMDLINK
#endif

#ifndef SOM_DATASEG_PRAGMAS
  #if defined(__IBMCPP__) || defined(__IBMC__)
    #define SOM_DATASEG_PRAGMAS
  #elif defined(__HIGHC__)
    #define SOM_DATASEG_PRAGMAS
  #elif defined(__WATCOMC__)
    #define SOM_DATASEG_PRAGMAS
  #elif defined(_PPC) && defined(_OS2)
    #define SOM_DATASEG_PRAGMAS
  #endif
#endif


#if defined(_WIN32)

#ifndef SOMDLLIMPORT
  // #if defined(__BCPLUSPLUS__)||defined(__BORLANDC__)
  //   // doesn't change anything until executed
  //   // when dllimported entity is not declared as such,
  //   // Borland generates call dword ptr instead of call trampolino
  //   #define SOMDLLIMPORT
  // #else
    #define SOMDLLIMPORT __declspec(dllimport)
  // #endif
#endif

#ifndef SOMDLLEXPORT
  #if defined(__BCPLUSPLUS__)||defined(__BORLANDC__)
    #define SOMDLLEXPORT
  #else
    #define SOMDLLEXPORT __declspec(dllexport)
  #endif
#endif
#endif /* defined(_WIN32) */


#define SOM_DEFAULT_VASIZE 4

#endif /* somplatf_h */
