public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bcmpinc at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug java/28153]  New: Under Windows Xp the generated JNI headers need to have a '_' prepended for each function.
Date: Sat, 24 Jun 2006 17:49:00 -0000	[thread overview]
Message-ID: <bug-28153-12871@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2006-06-24 16:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-24 17:49 bcmpinc at hotmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28153-12871@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).