This is the mail archive of the java@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]

Re: Marking JNI funtions extern


Mark Wielaard wrote:
>>but I'm curious.  In what way was this confusing the Kaffe build process?
> 
> 
> In certain cases they define JNIEXPORT as "extern" and "extern extern"
> isn't valid. I actually think they should not define JNIEXPORT as
> "extern" though, so next up is convincing them to fix their jni.h (or
> adopt the libgcj/GNU Classpath one of course).

Technically, "JNIEXPORT and JNICALL are macros used to
specify the calling and linkage convention of both JNI
functions and native method implementations":

  http://java.sun.com/docs/books/jni/html/types.html#46915

So they are not wrong per se, as far as the spec goes,
since "extern" is a valid (though default) linkage for
functions in C.

However, most likely these were introduced to fit in
"__declspec(dllexport)" and "__stdcall" from the
Windoze DLL world - this is reinforced by the JDK's
"$JDK\include\win32\jni_md.h" on Win32 and empty
JNIEXPORT definitions on Linux.

If we really want "extern" in our declarations (why?),
we should modify the JNIEXPORT definition for POSIXy
systems appropriately.

Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT gmail DOT com

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


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