OLD | NEW |
| (Empty) |
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 /******************************************************************************* | |
37 * Netscape version of jni_md.h -- depends on jri_md.h | |
38 ******************************************************************************/ | |
39 | |
40 #ifndef JNI_MD_H | |
41 #define JNI_MD_H | |
42 | |
43 #include "prtypes.h" /* needed for _declspec */ | |
44 | |
45 /******************************************************************************* | |
46 * WHAT'S UP WITH THIS FILE? | |
47 * | |
48 * This is where we define the mystical JNI_PUBLIC_API macro that works on all | |
49 * platforms. If you're running with Visual C++, Symantec C, or Borland's | |
50 * development environment on the PC, you're all set. Or if you're on the Mac | |
51 * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't | |
52 * matter. | |
53 | |
54 * Changes by sailesh on 9/26 | |
55 | |
56 * There are two symbols used in the declaration of the JNI functions | |
57 * and native code that uses the JNI: | |
58 * JNICALL - specifies the calling convention | |
59 * JNIEXPORT - specifies export status of the function | |
60 * | |
61 * The syntax to specify calling conventions is different in Win16 and | |
62 * Win32 - the brains at Micro$oft at work here. JavaSoft in their | |
63 * infinite wisdom cares for no platform other than Win32, and so they | |
64 * just define these two symbols as: | |
65 | |
66 #define JNIEXPORT __declspec(dllexport) | |
67 #define JNICALL __stdcall | |
68 | |
69 * We deal with this, in the way JRI defines the JRI_PUBLIC_API, by | |
70 * defining a macro called JNI_PUBLIC_API. Any of our developers who | |
71 * wish to use code for Win16 and Win32, _must_ use JNI_PUBLIC_API to | |
72 * be able to export functions properly. | |
73 | |
74 * Since we must also maintain compatibility with JavaSoft, we | |
75 * continue to define the symbol JNIEXPORT. However, use of this | |
76 * internally is deprecated, since it will cause a mess on Win16. | |
77 | |
78 * We _do not_ need a new symbol called JNICALL. Instead we | |
79 * redefine JNICALL in the same way JRI_CALLBACK was defined. | |
80 | |
81 ******************************************************************************/ | |
82 | |
83 /* DLL Entry modifiers... */ | |
84 #if defined(XP_OS2) | |
85 # ifdef XP_OS2_VACPP | |
86 # define JNI_PUBLIC_API(ResultType) ResultType _System | |
87 # define JNI_PUBLIC_VAR(VarType) VarType | |
88 # define JNICALL _Optlink | |
89 # define JNIEXPORT | |
90 # else | |
91 # define JNI_PUBLIC_API(ResultType) ResultType | |
92 # define JNI_PUBLIC_VAR(VarType) VarType | |
93 # define JNICALL | |
94 # define JNIEXPORT | |
95 # endif | |
96 /* Win32 */ | |
97 #elif defined(XP_WIN) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32) | |
98 # include <windows.h> | |
99 # if defined(_MSC_VER) || defined(__GNUC__) | |
100 # if defined(WIN32) || defined(_WIN32) | |
101 # define JNI_PUBLIC_API(ResultType) _declspec(dllexp
ort) ResultType __stdcall | |
102 # define JNI_PUBLIC_VAR(VarType) VarType | |
103 # define JNI_NATIVE_STUB(ResultType) _declspec(dllexp
ort) ResultType | |
104 # define JNICALL __stdcall | |
105 # else /* !_WIN32 */ | |
106 # if defined(_WINDLL) | |
107 # define JNI_PUBLIC_API(ResultType) ResultType __cde
cl __export __loadds | |
108 # define JNI_PUBLIC_VAR(VarType) VarType | |
109 # define JNI_NATIVE_STUB(ResultType) ResultType __cde
cl __loadds | |
110 # define JNICALL __loadds | |
111 # else /* !WINDLL */ | |
112 # define JNI_PUBLIC_API(ResultType) ResultType __cde
cl __export | |
113 # define JNI_PUBLIC_VAR(VarType) VarType | |
114 # define JNI_NATIVE_STUB(ResultType) ResultType __cde
cl __export | |
115 # define JNICALL __export | |
116 # endif /* !WINDLL */ | |
117 # endif /* !_WIN32 */ | |
118 # elif defined(__BORLANDC__) | |
119 # if defined(WIN32) || defined(_WIN32) | |
120 # define JNI_PUBLIC_API(ResultType) __export ResultT
ype | |
121 # define JNI_PUBLIC_VAR(VarType) VarType | |
122 # define JNI_NATIVE_STUB(ResultType) __export Result
Type | |
123 # define JNICALL | |
124 # else /* !_WIN32 */ | |
125 # define JNI_PUBLIC_API(ResultType) ResultType _cdec
l _export _loadds | |
126 # define JNI_PUBLIC_VAR(VarType) VarType | |
127 # define JNI_NATIVE_STUB(ResultType) ResultType _cdec
l _loadds | |
128 # define JNICALL _loadds | |
129 # endif | |
130 # else | |
131 # error Unsupported PC development environment. | |
132 # endif | |
133 # ifndef IS_LITTLE_ENDIAN | |
134 # define IS_LITTLE_ENDIAN | |
135 # endif | |
136 /* This is the stuff inherited from JavaSoft .. */ | |
137 # define JNIEXPORT __declspec(dllexport) | |
138 | |
139 | |
140 /* Mac */ | |
141 #elif macintosh || Macintosh || THINK_C | |
142 # if defined(__MWERKS__) /* Metrowerks */ | |
143 # if !__option(enumsalwaysint) | |
144 # error You need to define 'Enums Always Int' for your pro
ject. | |
145 # endif | |
146 # if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM | |
147 # if !__option(fourbyteints) | |
148 # error You need to define 'Struct Alignment: 68k'
for your project. | |
149 # endif | |
150 # endif /* !GENERATINGCFM */ | |
151 # define JNI_PUBLIC_API(ResultType) __declspec(export) Resul
tType | |
152 # define JNI_PUBLIC_VAR(VarType) JNI_PUBLIC_API(VarType) | |
153 # define JNI_NATIVE_STUB(ResultType) JNI_PUBLIC_API(ResultTyp
e) | |
154 # elif defined(__SC__) /* Symantec */ | |
155 # error What are the Symantec defines? (warren@netscape.com) | |
156 # elif macintosh && applec /* MPW */ | |
157 # error Please upgrade to the latest MPW compiler (SC). | |
158 # else | |
159 # error Unsupported Mac development environment. | |
160 # endif | |
161 # define JNICALL | |
162 /* This is the stuff inherited from JavaSoft .. */ | |
163 # define JNIEXPORT | |
164 | |
165 /* Unix or else */ | |
166 #else | |
167 # define JNI_PUBLIC_API(ResultType) ResultType | |
168 # define JNI_PUBLIC_VAR(VarType) VarType | |
169 # define JNI_NATIVE_STUB(ResultType) ResultType | |
170 # define JNICALL | |
171 /* This is the stuff inherited from JavaSoft .. */ | |
172 # define JNIEXPORT | |
173 #endif | |
174 | |
175 #ifndef FAR /* for non-Win16 */ | |
176 #define FAR | |
177 #endif | |
178 | |
179 /* Get the rest of the stuff from jri_md.h */ | |
180 #include "jri_md.h" | |
181 | |
182 #endif /* JNI_MD_H */ | |
OLD | NEW |