This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [MinGW]: Don't add dll[im/ex]port attributes to libgcj, unless dll build


Hi People,

>The marking of JNI_* functions as dll[im/ex]port causes problems
>when libgcj.a is built as static lib.

As mentioned here:

http://gcc.gnu.org/ml/java/2003-11/msg00078.html

...a slight variant of this patch:

http://gcc.gnu.org/ml/java-patches/2003-q3/msg00272.html

...was applied to the cygming-3.3.1 branch, but not to
CVS HEAD. This needs to go to CVS HEAD for the same
reasons it went to the cygming branch.

I went into CVS, created diffs between the post-patch and
pre-patch versions, updated Danny's ChangeLog, and created
a patch which applies cleanly to CVS HEAD. I put Danny's
name on this patch. I tested this successfully on
(i686-pc-linux-gnu,i686-pc-linux-gnu,i686-pc-linux-gnu),
(i686-pc-linux-gnu,i686-pc-linux-gnu,i686-pc-mingw32), and
(i686-pc-linux-gnu,i686-pc-mingw32,i686-pc-mingw32).

- Danny: can you confirm that you're okay with this?
- Once Danny does this, can someone approve this?

Thanks.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

2003-11-09  Danny Smith  <dannysmith@users.sourceforge.net>

	* jni.cc (JNI_CreateJavaVM): Remove JNIEXPORT.
	(JNI_GetCreatedJavaVMs): Likewise.
	(JNI_GetDefaultJavaVMInitArgs): Likewise.
	* include/jni.h (JNIIMPEXP): Remove definition
	and replace with...
	(__GCJ_JNIIMPEXP__): New macro, applicable only to libgcj
	symbols,
	(__GCJ_DLL__): New macro, controlling __GCJ_JNIIMPEXP__.

Index: jni.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni.cc,v
retrieving revision 1.77
diff -u -2 -r1.77 jni.cc
--- jni.cc	26 Oct 2003 02:25:41 -0000	1.77
+++ jni.cc	9 Nov 2003 05:15:07 -0000
@@ -2378,5 +2378,5 @@
 }
 
-JNIEXPORT jint JNICALL
+jint JNICALL
 JNI_GetDefaultJavaVMInitArgs (void *args)
 {
@@ -2395,5 +2395,5 @@
 }
 
-JNIEXPORT jint JNICALL
+jint JNICALL
 JNI_CreateJavaVM (JavaVM **vm, void **penv, void *args)
 {
@@ -2460,5 +2460,5 @@
 }
 
-JNIEXPORT jint JNICALL
+jint JNICALL
 JNI_GetCreatedJavaVMs (JavaVM **vm_buffer, jsize buf_len, jsize *n_vms)
 {
Index: include/jni.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/jni.h,v
retrieving revision 1.25
diff -u -2 -r1.25 jni.h
--- include/jni.h	28 Dec 2002 06:38:52 -0000	1.25
+++ include/jni.h	9 Nov 2003 05:15:13 -0000
@@ -179,20 +179,28 @@
 #define JNIIMPORT        __declspec(dllimport)
 #define JNIEXPORT        __declspec(dllexport)
+
 #define JNICALL          __stdcall
 
-#else
+/* These defines apply to symbols in libgcj */
+#ifdef __GCJ_DLL__
+# ifdef __GCJ_JNI_IMPL__
+#  define __GCJ_JNIIMPEXP__ JNIEXPORT
+# else
+#  define __GCJ_JNIIMPEXP__ JNIIMPORT
+# endif /* ! __GCJ_JNI_IMPL__ */
+#else /* ! __GCJ_DLL__ */
+# define __GCJ_JNIIMPEXP__
+#endif /*  __GCJ_DLL__ */
+
+#else /* !( _WIN32 || __WIN32__ || WIN32) */
 
 #define JNIIMPORT
 #define JNIEXPORT
 #define JNICALL
+#define __GCJ_JNIIMPEXP__
 
 #endif /* !( _WIN32 || __WIN32__ || WIN32) */
 
-#ifdef __GCJ_JNI_IMPL__
-#define JNIIMPEXP JNIEXPORT
-#else
-#define JNIIMPEXP JNIIMPORT
-#endif /* ! __GCJ_JNI_IMPL__ */
-
+ 
 #ifdef __cplusplus
 extern "C"
@@ -207,7 +215,7 @@
 /* These functions are called by user code to start using the
    invocation API.  */
-extern JNIIMPEXP jint JNICALL JNI_GetDefaultJavaVMInitArgs (void *);
-extern JNIIMPEXP jint JNICALL JNI_CreateJavaVM (JavaVM **, void **, void *);
-extern JNIIMPEXP jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
+extern __GCJ_JNIIMPEXP__ jint JNICALL JNI_GetDefaultJavaVMInitArgs (void *);
+extern __GCJ_JNIIMPEXP__ jint JNICALL JNI_CreateJavaVM (JavaVM **, void **, void *);
+extern __GCJ_JNIIMPEXP__ jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
 
 #ifdef __cplusplus




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]