Back to index

lightning-sunbird  0.9+nobinonly
jni_md.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK *****
00038  *
00039  *
00040  * This Original Code has been modified by IBM Corporation.
00041  * Modifications made by IBM described herein are
00042  * Copyright (c) International Business Machines
00043  * Corporation, 2000
00044  *
00045  * Modifications to Mozilla code or documentation
00046  * identified per MPL Section 3.3
00047  *
00048  * Date         Modified by     Description of modification
00049  * 03/27/2000   IBM Corp.       Set JNICALL to Optlink for
00050  *                               use in OS2
00051  */
00052 
00053 /*******************************************************************************
00054  * Netscape version of jni_md.h -- depends on jri_md.h
00055  ******************************************************************************/
00056 
00057 #ifndef JNI_MD_H
00058 #define JNI_MD_H
00059 
00060 #include "prtypes.h" /* needed for _declspec */
00061 
00062 /*******************************************************************************
00063  * WHAT'S UP WITH THIS FILE?
00064  * 
00065  * This is where we define the mystical JNI_PUBLIC_API macro that works on all
00066  * platforms. If you're running with Visual C++, Symantec C, or Borland's 
00067  * development environment on the PC, you're all set. Or if you're on the Mac
00068  * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
00069  * matter.
00070 
00071  * Changes by sailesh on 9/26 
00072 
00073  * There are two symbols used in the declaration of the JNI functions
00074  * and native code that uses the JNI:
00075  * JNICALL - specifies the calling convention 
00076  * JNIEXPORT - specifies export status of the function 
00077  * 
00078  * The syntax to specify calling conventions is different in Win16 and
00079  * Win32 - the brains at Micro$oft at work here. JavaSoft in their
00080  * infinite wisdom cares for no platform other than Win32, and so they
00081  * just define these two symbols as:
00082 
00083  #define JNIEXPORT __declspec(dllexport)
00084  #define JNICALL __stdcall
00085 
00086  * We deal with this, in the way JRI defines the JRI_PUBLIC_API, by
00087  * defining a macro called JNI_PUBLIC_API. Any of our developers who
00088  * wish to use code for Win16 and Win32, _must_ use JNI_PUBLIC_API to
00089  * be able to export functions properly.
00090 
00091  * Since we must also maintain compatibility with JavaSoft, we
00092  * continue to define the symbol JNIEXPORT. However, use of this
00093  * internally is deprecated, since it will cause a mess on Win16.
00094 
00095  * We _do not_ need a new symbol called JNICALL. Instead we
00096  * redefine JNICALL in the same way JRI_CALLBACK was defined.
00097 
00098  ******************************************************************************/
00099 
00100 /* DLL Entry modifiers... */
00101 #if defined(XP_OS2)
00102 #  ifdef XP_OS2_VACPP
00103 #     define JNI_PUBLIC_API(ResultType)      ResultType _System
00104 #     define JNI_PUBLIC_VAR(VarType)         VarType
00105 #     define JNICALL                         _Optlink
00106 #     define JNIEXPORT
00107 #  else
00108 #     define JNI_PUBLIC_API(ResultType)      ResultType
00109 #     define JNI_PUBLIC_VAR(VarType)         VarType
00110 #     define JNICALL
00111 #     define JNIEXPORT
00112 #  endif
00113 /* Win32 */
00114 #elif defined(XP_WIN) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
00115 #      include <windows.h>
00116 #      if defined(_MSC_VER) || defined(__GNUC__)
00117 #             if defined(WIN32) || defined(_WIN32)
00118 #                    define JNI_PUBLIC_API(ResultType)  _declspec(dllexport) ResultType __stdcall
00119 #                    define JNI_PUBLIC_VAR(VarType)            VarType
00120 #                    define JNI_NATIVE_STUB(ResultType) _declspec(dllexport) ResultType
00121 #                    define JNICALL                          __stdcall
00122 #             else /* !_WIN32 */
00123 #                 if defined(_WINDLL)
00124 #                    define JNI_PUBLIC_API(ResultType)  ResultType __cdecl __export __loadds 
00125 #                    define JNI_PUBLIC_VAR(VarType)            VarType
00126 #                    define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds
00127 #                    define JNICALL                             __loadds
00128 #                 else /* !WINDLL */
00129 #                    define JNI_PUBLIC_API(ResultType)  ResultType __cdecl __export
00130 #                    define JNI_PUBLIC_VAR(VarType)            VarType
00131 #                    define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __export
00132 #                    define JNICALL                             __export
00133 #                   endif /* !WINDLL */
00134 #             endif /* !_WIN32 */
00135 #      elif defined(__BORLANDC__)
00136 #             if defined(WIN32) || defined(_WIN32)
00137 #                    define JNI_PUBLIC_API(ResultType)  __export ResultType
00138 #                    define JNI_PUBLIC_VAR(VarType)            VarType
00139 #                    define JNI_NATIVE_STUB(ResultType)  __export ResultType
00140 #                    define JNICALL
00141 #             else /* !_WIN32 */
00142 #                    define JNI_PUBLIC_API(ResultType)  ResultType _cdecl _export _loadds 
00143 #                    define JNI_PUBLIC_VAR(VarType)            VarType
00144 #                    define JNI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds
00145 #                    define JNICALL                     _loadds
00146 #             endif
00147 #      else
00148 #             error Unsupported PC development environment.    
00149 #      endif
00150 #      ifndef IS_LITTLE_ENDIAN
00151 #             define IS_LITTLE_ENDIAN
00152 #      endif
00153        /*  This is the stuff inherited from JavaSoft .. */
00154 #      define JNIEXPORT __declspec(dllexport)
00155 
00156 
00157 /* Mac */
00158 #elif macintosh || Macintosh || THINK_C
00159 #      if defined(__MWERKS__)                           /* Metrowerks */
00160 #             if !__option(enumsalwaysint)
00161 #                    error You need to define 'Enums Always Int' for your project.
00162 #             endif
00163 #             if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM 
00164 #                    if !__option(fourbyteints) 
00165 #                           error You need to define 'Struct Alignment: 68k' for your project.
00166 #                    endif
00167 #             endif /* !GENERATINGCFM */
00168 #             define JNI_PUBLIC_API(ResultType)  __declspec(export) ResultType 
00169 #             define JNI_PUBLIC_VAR(VarType)            JNI_PUBLIC_API(VarType)
00170 #             define JNI_NATIVE_STUB(ResultType) JNI_PUBLIC_API(ResultType)
00171 #      elif defined(__SC__)                      /* Symantec */
00172 #             error What are the Symantec defines? (warren@netscape.com)
00173 #      elif macintosh && applec                  /* MPW */
00174 #             error Please upgrade to the latest MPW compiler (SC).
00175 #      else
00176 #             error Unsupported Mac development environment.
00177 #      endif
00178 #      define JNICALL
00179        /*  This is the stuff inherited from JavaSoft .. */
00180 #      define JNIEXPORT
00181 
00182 /* Unix or else */
00183 #else
00184 #      define JNI_PUBLIC_API(ResultType)         ResultType
00185 #       define JNI_PUBLIC_VAR(VarType)                  VarType
00186 #       define JNI_NATIVE_STUB(ResultType)              ResultType
00187 #      define JNICALL
00188        /*  This is the stuff inherited from JavaSoft .. */
00189 #      define JNIEXPORT
00190 #endif
00191 
00192 #ifndef FAR          /* for non-Win16 */
00193 #define FAR
00194 #endif
00195 
00196 /* Get the rest of the stuff from jri_md.h */
00197 #include "jri_md.h"
00198 
00199 #endif /* JNI_MD_H */