Patch: jni.h: Define JNICALL, JNIIMPORT and JNIEXPORT for Win32

Ranjit Mathew rmathew@hotmail.com
Thu Nov 7 21:21:00 GMT 2002


Hi,

     The following trivial patch updates the JNI linker
defines for Win32 in jni.h.

Please note that as of this writing, __stdcall JNI methods
will *not* work on Win32 - that would require a few
more patches - to libffi, libgcj and GCJ. I hope to post
these as well real soon.

Another thing to note is the use of _WIN32, __WIN32__ and
WIN32 - _WIN32 is the MS specified Win32 define, some
compilers define __WIN32__ and libgcj itself uses WIN32.
I didn't know which one to favour over the others... :-)

ChangeLog:

2002-11-08  Ranjit Mathew <rmathew@hotmail.com>

     * include/jni.h: Update JNIIMPORT, JNIEXPORT and JNICALL
     linker defines for Win32. JNICALL has been defined to
     __stdcall to be compatible with Sun's JDKs.

------------------------ 8< ------------------------------
--- jni.h	Fri Nov  8 10:35:16 2002
+++ jni.h	Fri Nov  8 10:40:13 2002
@@ -174,9 +174,18 @@
  #define JNI_EVERSION     -3

-/* Linkage and calling conventions.  This will need updating when we
-   support Windows DLLs.  */
+/* Linkage and calling conventions. */
+#if defined(_WIN32) || defined (__WIN32__) || defined (WIN32)
+
+#define JNIIMPORT        __declspec(dllimport)
+#define JNIEXPORT        __declspec(dllexport)
+#define JNICALL          __stdcall
+
+#else
+
  #define JNIIMPORT
  #define JNIEXPORT
  #define JNICALL
+
+#endif /* !( _WIN32 || __WIN32__ || WIN32) */

  #ifdef __cplusplus
------------------------ 8< ------------------------------

Sincerely Yours,
Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/





More information about the Java-patches mailing list