Re: java.lang.UnsatisfiedLinkError - native method



On 13 nov., 15:19, Gordon Beaton <n....@xxxxxxxxx> wrote:
On Tue, 13 Nov 2007 06:05:52 -0800, andrej.fre...@xxxxxxxxx wrote:
Exception in thread "main" java.lang.UnsatisfiedLinkError: helloworld

[...]

my NEWLY added helloworld function contains this "__Fv" at the end
of the name that is why i think it cannot be found by the java
class.

How (exactly) do you compile the native library? Are you using a C
compiler, or a C++ compiler?

I am using the hp-ux aC++ compiler.


Is the failing method declared with extern "C"? It should be, and it
will be if you exactly obeyed the declaration that javah provided for
you in the generated header file. If the signature of your
implementation differs from that in the header file, the extern "C"
javah provided is no longer helping you.

Functions are all marked with extern "C" and i did obey the
declaration( at least i hope so)
of javah.

The .h file looks like that:

extern "C" {
JNIEXPORT jint JNICALL Java_helloworld
(JNIEnv *, jobject);

JNIEXPORT jint JNICALL Java_ApplModify
(JNIEnv *, jobject, jlong, jlong, jlong);

..... there are more functions

}

I very much appreciate your help Gordon.
Need more code?
Regards,
A

/gordon

--


.



Relevant Pages

  • Re: accessing files in subfolders
    ... > requests with extern "C", e.g., ... Most of what I'm referring to here is inside ogg vorbis ... >>causing confusion in the compiler. ...
    (microsoft.public.vc.mfc)
  • Re: How to debug Link errors of static LIB in eVC?
    ... extern "C" { ... directory of the header file which I had set. ... but your compiler finds somehow the C++ prototype of the function and generates the decorated name for the unresolved external. ... PPlugin_PSoundChannel_WAVFile_Registration_Instance that returns a PPlugin_PSoundChannel_WAVFile_Registration class object. ...
    (microsoft.public.windowsce.embedded.vc)
  • Problems compiling C for JNI using gcc
    ... so I've downloaded the DGJPP GNU C compiler from ... compiler is complaining about the code in the jni.h header file. ... I have fixed the definition of jlong like this: ... typedef long long jlong; ...
    (comp.lang.java.help)
  • Re: extern for global variable: C Question
    ... because the compiler couldn't find a definition anywhere, ... extern long MQ; ... declare a variable and then define it down stream of our program... ... is the difference if we declare it in a header and include that header in a ...
    (microsoft.public.vc.language)
  • Re: endianness and failure with inline
    ... Why should we bother about something that the compiler is free to ... It's declared inline, there's not an external definition of it. ... because it's declared inline without an extern modifier. ...
    (comp.lang.c)