Re: java.lang.UnsatisfiedLinkError - native method



On Tue, 13 Nov 2007 06:05:52 -0800, andrej.frelih@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?

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.

/gordon

--
.



Relevant Pages

  • 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)
  • Re: header files
    ... As all code can be written in the header file ... > void foo() ... > compiler tries to compile main.c it eventually reaches the line ... > the compiler has never heared about a function called printf(). ...
    (alt.comp.lang.learn.c-cpp)
  • Re: include file question
    ... Where did you read that #pragma once is obsolete? ... because it suggests that what you need is some kind of weird compiler hack to make your ... inside the header file to prevent multiple execution of the contents. ... documentation about Objective C, which is a language which is NOT the C++ language, has ...
    (microsoft.public.vc.mfc)
  • Re: header files
    ... As all code can be written in the header file ... void foo() ... So when the compiler compiles ... the compiler has never heared about a function called printf(). ...
    (alt.comp.lang.learn.c-cpp)
  • Re: #include what?
    ... everyone did command line programming in something akin to a "shell". ... the compiler has to pick somewhere to look for the ... of a header file in the local directory and then hack it to override ... features of the old style that we lost with the modern interpretation. ...
    (comp.compilers)