jni_md.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. *
  3. * The contents of this file are subject to the Netscape Public
  4. * License Version 1.1 (the "License"); you may not use this file
  5. * except in compliance with the License. You may obtain a copy of
  6. * the License at http://www.mozilla.org/NPL/
  7. *
  8. * Software distributed under the License is distributed on an "AS
  9. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10. * implied. See the License for the specific language governing
  11. * rights and limitations under the License.
  12. *
  13. * The Original Code is mozilla.org code.
  14. *
  15. * The Initial Developer of the Original Code is Netscape
  16. * Communications Corporation. Portions created by Netscape are
  17. * Copyright (C) 1998 Netscape Communications Corporation. All
  18. * Rights Reserved.
  19. *
  20. * Contributor(s):
  21. *
  22. *
  23. * This Original Code has been modified by IBM Corporation.
  24. * Modifications made by IBM described herein are
  25. * Copyright (c) International Business Machines
  26. * Corporation, 2000
  27. *
  28. * Modifications to Mozilla code or documentation
  29. * identified per MPL Section 3.3
  30. *
  31. * Date Modified by Description of modification
  32. * 03/27/2000 IBM Corp. Set JNICALL to Optlink for
  33. * use in OS2
  34. */
  35. /*******************************************************************************
  36. * Netscape version of jni_md.h -- depends on jri_md.h
  37. ******************************************************************************/
  38. #ifndef JNI_MD_H
  39. #define JNI_MD_H
  40. #include "prtypes.h" /* needed for _declspec */
  41. /*******************************************************************************
  42. * WHAT'S UP WITH THIS FILE?
  43. *
  44. * This is where we define the mystical JNI_PUBLIC_API macro that works on all
  45. * platforms. If you're running with Visual C++, Symantec C, or Borland's
  46. * development environment on the PC, you're all set. Or if you're on the Mac
  47. * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
  48. * matter.
  49. * Changes by sailesh on 9/26
  50. * There are two symbols used in the declaration of the JNI functions
  51. * and native code that uses the JNI:
  52. * JNICALL - specifies the calling convention
  53. * JNIEXPORT - specifies export status of the function
  54. *
  55. * The syntax to specify calling conventions is different in Win16 and
  56. * Win32 - the brains at Micro$oft at work here. JavaSoft in their
  57. * infinite wisdom cares for no platform other than Win32, and so they
  58. * just define these two symbols as:
  59. #define JNIEXPORT __declspec(dllexport)
  60. #define JNICALL __stdcall
  61. * We deal with this, in the way JRI defines the JRI_PUBLIC_API, by
  62. * defining a macro called JNI_PUBLIC_API. Any of our developers who
  63. * wish to use code for Win16 and Win32, _must_ use JNI_PUBLIC_API to
  64. * be able to export functions properly.
  65. * Since we must also maintain compatibility with JavaSoft, we
  66. * continue to define the symbol JNIEXPORT. However, use of this
  67. * internally is deprecated, since it will cause a mess on Win16.
  68. * We _do not_ need a new symbol called JNICALL. Instead we
  69. * redefine JNICALL in the same way JRI_CALLBACK was defined.
  70. ******************************************************************************/
  71. /* DLL Entry modifiers... */
  72. #if defined(XP_OS2)
  73. # ifdef XP_OS2_VACPP
  74. # define JNI_PUBLIC_API(ResultType) ResultType _System
  75. # define JNI_PUBLIC_VAR(VarType) VarType
  76. # define JNICALL _Optlink
  77. # define JNIEXPORT
  78. # else
  79. # define JNI_PUBLIC_API(ResultType) ResultType
  80. # define JNI_PUBLIC_VAR(VarType) VarType
  81. # define JNICALL
  82. # define JNIEXPORT
  83. # endif
  84. /* Win32 */
  85. #elif defined(XP_WIN) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
  86. # include <windows.h>
  87. # if defined(_MSC_VER) || defined(__GNUC__)
  88. # if defined(WIN32) || defined(_WIN32)
  89. # define JNI_PUBLIC_API(ResultType) _declspec(dllexport) ResultType __stdcall
  90. # define JNI_PUBLIC_VAR(VarType) VarType
  91. # define JNI_NATIVE_STUB(ResultType) _declspec(dllexport) ResultType
  92. # define JNICALL __stdcall
  93. # else /* !_WIN32 */
  94. # if defined(_WINDLL)
  95. # define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds
  96. # define JNI_PUBLIC_VAR(VarType) VarType
  97. # define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds
  98. # define JNICALL __loadds
  99. # else /* !WINDLL */
  100. # define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export
  101. # define JNI_PUBLIC_VAR(VarType) VarType
  102. # define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __export
  103. # define JNICALL __export
  104. # endif /* !WINDLL */
  105. # endif /* !_WIN32 */
  106. # elif defined(__BORLANDC__)
  107. # if defined(WIN32) || defined(_WIN32)
  108. # define JNI_PUBLIC_API(ResultType) __export ResultType
  109. # define JNI_PUBLIC_VAR(VarType) VarType
  110. # define JNI_NATIVE_STUB(ResultType) __export ResultType
  111. # define JNICALL
  112. # else /* !_WIN32 */
  113. # define JNI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds
  114. # define JNI_PUBLIC_VAR(VarType) VarType
  115. # define JNI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds
  116. # define JNICALL _loadds
  117. # endif
  118. # else
  119. # error Unsupported PC development environment.
  120. # endif
  121. # ifndef IS_LITTLE_ENDIAN
  122. # define IS_LITTLE_ENDIAN
  123. # endif
  124. /* This is the stuff inherited from JavaSoft .. */
  125. # define JNIEXPORT __declspec(dllexport)
  126. /* Mac */
  127. #elif macintosh || Macintosh || THINK_C
  128. # if defined(__MWERKS__) /* Metrowerks */
  129. # if !__option(enumsalwaysint)
  130. # error You need to define 'Enums Always Int' for your project.
  131. # endif
  132. # if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM
  133. # if !__option(fourbyteints)
  134. # error You need to define 'Struct Alignment: 68k' for your project.
  135. # endif
  136. # endif /* !GENERATINGCFM */
  137. # define JNI_PUBLIC_API(ResultType) __declspec(export) ResultType
  138. # define JNI_PUBLIC_VAR(VarType) JNI_PUBLIC_API(VarType)
  139. # define JNI_NATIVE_STUB(ResultType) JNI_PUBLIC_API(ResultType)
  140. # elif defined(__SC__) /* Symantec */
  141. # error What are the Symantec defines? ([email protected])
  142. # elif macintosh && applec /* MPW */
  143. # error Please upgrade to the latest MPW compiler (SC).
  144. # else
  145. # error Unsupported Mac development environment.
  146. # endif
  147. # define JNICALL
  148. /* This is the stuff inherited from JavaSoft .. */
  149. # define JNIEXPORT
  150. /* Unix or else */
  151. #else
  152. # define JNI_PUBLIC_API(ResultType) ResultType
  153. # define JNI_PUBLIC_VAR(VarType) VarType
  154. # define JNI_NATIVE_STUB(ResultType) ResultType
  155. # define JNICALL
  156. /* This is the stuff inherited from JavaSoft .. */
  157. # define JNIEXPORT
  158. #endif
  159. #ifndef FAR /* for non-Win16 */
  160. #define FAR
  161. #endif
  162. /* Get the rest of the stuff from jri_md.h */
  163. #include "jri_md.h"
  164. #endif /* JNI_MD_H */