Looks like your system has an older glibc (probably 2.3) installed,
and the jna.jar you have was compiled against glibc 2.4 (the current
trunk binary build for linux uses glibc 2.3).
Do "/lib/libc.so.6" on the command line and it'll print the version
of glibc in use.
On Oct 27, 2007, at 2:10 PM, Quartz wrote:
Hi,
//I made an interface Pthread.java:
import com.sun.jna.Library;
import com.sun.jna.Native;
public interface Pthread extends Library {
Pthread INSTANCE = (Pthread)Native.loadLibrary("pthread",
Pthread.class);
int pthread_self();
}
//And them I made a simple test class:
public class TaskId {
public static void main(String[] args) throws Exception {
System.out.println("pthread_self() returned
"+Pthread.INSTANCE.pthread_self());
}
}
//Then I compiled and ran it, and got:
javac -cp jna.jar *.java
java -cp jna.jar:. TaskId
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/
jna47643.tmp: /lib/libc.so.6:
version `GLIBC_2.4' not found (required by /tmp/jna47643.tmp)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
...
What's going on? (forgive my lack of knowlege)
--- Timothy Wall <twal...@dev.java.net> wrote:
I would guess linux uses pthreads, but you could browse the JVM
source to be sure. I would imagine you might find what you're
looking for in the native java.lang.Thread sources.
I'm inferring that task corresponds to thread, so if you make a
pthread call to get the thread id, that might be what you're looking
for.
The thread/task id might even be tucked away in a private member of a
platform-specific class (this is the case with 1.6+ for AWT window
handles).