UnsatisfiedLinkError for native function of inner class
Hello,
I have a problem with native functions of inner classes.
Here is the code:
class Outer
{
publicstaticclass Inner{
nativepublicvoid innerFct();
}
publicstaticvoid main(String[] args){
Inner i =new Inner();
i.innerFct();
}
static{
System.loadLibrary("OuterInner");
}
}
javah generates this
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Outer_Inner */
#ifndef _Included_Outer_Inner
#define _Included_Outer_Inner
#ifdef __cplusplus
extern"C"{
#endif
/*
* Class:Outer_Inner
* Method:innerFct
* Signature: ()V
*/
JNIEXPORTvoid JNICALL Java_Outer_Inner_innerFct
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
Dumping shows that the symbol is in the dll
$ /cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 8/VC/bin/amd64
/link.exe /dump /exports OuterInner.dll
Microsoft (R) COFF/PE Dumper Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file OuterInner.dll
File Type: DLL
Section contains the following exports for OuterInner.dll
00000000 characteristics
4581C2A7 time date stamp Thu Dec 14 22:31:19 2006
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVAname
10 00001000 Java_Outer_Inner_innerFct
Summary
3000 .data
1000 .pdata
3000 .rdata
1000 .reloc
7000 .text
and the dll gets loaded without a problem, but at execution I get
$ java Outer
Exception in thread "main" java.lang.UnsatisfiedLinkError: innerFct
at Outer$Inner.innerFct(Native Method)
at Outer.main(Outer.java:13)
I am on Windows XP64 on a Turion, and the Java version is:
$ java -version
java version "1.5.0_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_10-b03, mixed mode)

