public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/28153]  New: Under Windows Xp the generated JNI headers need to have a '_' prepended for each function.
@ 2006-06-24 17:49 bcmpinc at hotmail dot com
  2006-06-26 18:17 ` [Bug java/28153] " tromey at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: bcmpinc at hotmail dot com @ 2006-06-24 17:49 UTC (permalink / raw)
  To: gcc-bugs

I had some problems when I tried to compile a JNI-example from wikipedia:
  http://en.wikipedia.org/wiki/JNI

I compiled the Java-source containing the native function 
with 'gcj -C' (gcc version 3.4.2 (mingw-special)):
  public native void sayHello();

I passed the class-file to 'gcjh -jni' and it produced a header with the line:
  extern JNIEXPORT void JNICALL Java_JavaSide_sayHello (JNIEnv *env, jobject);

I implemented the function, compiled it with 'g++ -O2 -shared'
When I tried to run the java class it gave an error when it called the native
function.

I examined some other dll's used by java (with depens.exe) and all the
functions 
had a '_' prepended.
I changed the line in the header file to:
  extern JNIEXPORT void JNICALL _Java_JavaSide_sayHello (JNIEnv *env, jobject);

Recompiled the C++ source and ran the java class. This time the function worked 
without any problems.


-- 
           Summary: Under Windows Xp the generated JNI headers need to have
                    a '_' prepended for each function.
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bcmpinc at hotmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28153


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-01-30 21:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-24 17:49 [Bug java/28153] New: Under Windows Xp the generated JNI headers need to have a '_' prepended for each function bcmpinc at hotmail dot com
2006-06-26 18:17 ` [Bug java/28153] " tromey at gcc dot gnu dot org
2006-06-26 21:08 ` bcmpinc at hotmail dot com
2006-06-26 21:25 ` dannysmith at users dot sourceforge dot net
2006-06-26 22:42 ` dannysmith at users dot sourceforge dot net
2006-06-27  4:09 ` tromey at gcc dot gnu dot org
2006-07-06  0:05 ` tromey at gcc dot gnu dot org
2006-07-06 12:39 ` bcmpinc at hotmail dot com
2006-08-07 16:30 ` tromey at gcc dot gnu dot org
2007-01-30 21:03 ` tromey at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).