The following code :
 
------------------------------------
unsigned long lenReaderList;
 long returnCode = SCardListReaders(0, 0, 0, &lenReaderList);
 std::cout << pcsc_stringify_error(returnCode) << std::endl;
 if (returnCode != SCARD_S_SUCCESS) {
  ...
 }

 // Allocate space for the readers list
 char* readerList = new char[(unsigned int)lenReaderList + 1];
 returnCode = SCardListReaders(0, 0, readerList, &lenReaderList);
 std::cout << pcsc_stringify_error(returnCode) << std::endl;
------------------------------------ 
 
works fine when called from a C program but generates the following trace :
 
------------------------------------
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x40024aa0
Function name=__pthread_mutex_lock
Library=/lib/libpthread.so.0
 
Current Java thread:
 at com.gemplus.components.pcscrm.PcscResourceManager.SCardListReaders(Native Method)
 at test.pcscrm.TestPcscResourceManager.testSCardListReaders(TestPcscResourceManager.java:31)
 at java.lang.reflect.Method.invoke(Native Method)
 at junit.framework.TestCase.runTest(TestCase.java:155)
 at junit.framework.TestCase.runBare(TestCase.java:129)
 at junit.framework.TestResult$1.protect(TestResult.java:100)
 at junit.framework.TestResult.runProtected(TestResult.java:117)
 at junit.framework.TestResult.run(TestResult.java:103)
 at junit.framework.TestCase.run(TestCase.java:120)
 at junit.framework.TestSuite.run(TestSuite.java:144)
 at junit.framework.TestSuite.run(TestSuite.java:144)
 at com.gemplus.components.junit.textui.TestRunner.doRun(TestRunner.java:242)
 at com.gemplus.components.junit.textui.TestRunner.start(TestRunner.java:204)
 at com.gemplus.components.junit.textui.TestRunner.main(TestRunner.java:323)
 
Dynamic libraries:
08048000-0804c000 r-xp 00000000 08:05 815208     /home/jpg/jdk1.3/bin/i386/native_threads/java
0804c000-0804d000 rw-p 00003000 08:05 815208     /home/jpg/jdk1.3/bin/i386/native_threads/java
40000000-40012000 r-xp 00000000 08:05 536451     /lib/ld-2.1.3.so
40012000-40013000 rw-p 00011000 08:05 536451     /lib/ld-2.1.3.so
40014000-40015000 r--p 00000000 08:05 114214     /usr/share/locale/fr_FR/LC_MESSAGES/SYS_LC_MESSAGES
40015000-40016000 r--p 00000000 08:05 829394     /usr/share/locale/fr_FR/LC_MONETARY
40016000-4001e000 r--p 00000000 08:05 829392     /usr/share/locale/fr_FR/LC_COLLATE
4001e000-4002a000 r-xp 00000000 08:05 536496     /lib/libpthread-0.8.so
4002a000-40031000 rw-p 0000b000 08:05 536496     /lib/libpthread-0.8.so
40031000-4003a000 r-xp 00000000 08:05 880088     /home/jpg/jdk1.3/jre/lib/i386/native_threads/libhpi.so
4003a000-4003b000 rw-p 00008000 08:05 880088     /home/jpg/jdk1.3/jre/lib/i386/native_threads/libhpi.so
4003b000-402a2000 r-xp 00000000 08:05 767230     /home/jpg/jdk1.3/jre/lib/i386/client/libjvm.so
402a2000-40408000 rw-p 00266000 08:05 767230     /home/jpg/jdk1.3/jre/lib/i386/client/libjvm.so
4041f000-40421000 r-xp 00000000 08:05 536466     /lib/libdl-2.1.3.so
40421000-40423000 rw-p 00001000 08:05 536466     /lib/libdl-2.1.3.so
40424000-40503000 r-xp 00000000 08:05 536457     /lib/libc-2.1.3.so
40503000-40508000 rw-p 000de000 08:05 536457     /lib/libc-2.1.3.so
4050b000-4051e000 r-xp 00000000 08:05 536470     /lib/libnsl-2.1.3.so
4051e000-40520000 rw-p 00012000 08:05 536470     /lib/libnsl-2.1.3.so
40522000-4053f000 r-xp 00000000 08:05 536468     /lib/libm-2.1.3.so
4053f000-40540000 rw-p 0001c000 08:05 536468     /lib/libm-2.1.3.so
40540000-4057a000 r-xp 00000000 08:05 845337     /usr/lib/libstdc++-3-libc6.1-2-2.10.0.so
4057a000-4058d000 rw-p 00039000 08:05 845337     /usr/lib/libstdc++-3-libc6.1-2-2.10.0.so
4058f000-405a0000 r-xp 00000000 08:05 880091     /home/jpg/jdk1.3/jre/lib/i386/libverify.so
405a0000-405a2000 rw-p 00010000 08:05 880091     /home/jpg/jdk1.3/jre/lib/i386/libverify.so
405a2000-405c3000 r-xp 00000000 08:05 880092     /home/jpg/jdk1.3/jre/lib/i386/libjava.so
405c3000-405c5000 rw-p 00020000 08:05 880092     /home/jpg/jdk1.3/jre/lib/i386/libjava.so
405c6000-405da000 r-xp 00000000 08:05 880093     /home/jpg/jdk1.3/jre/lib/i386/libzip.so
405da000-405dd000 rw-p 00013000 08:05 880093     /home/jpg/jdk1.3/jre/lib/i386/libzip.so
405dd000-412f6000 r--s 00000000 08:05 880122     /home/jpg/jdk1.3/jre/lib/rt.jar
41323000-415c8000 r--s 00000000 08:05 880123     /home/jpg/jdk1.3/jre/lib/i18n.jar
415c8000-415de000 r--s 00000000 08:05 880110     /home/jpg/jdk1.3/jre/lib/sunrsasign.jar
43686000-43687000 r--p 00000000 08:05 829396     /usr/share/locale/fr_FR/LC_TIME
43687000-43688000 r--p 00000000 08:05 829395     /usr/share/locale/fr_FR/LC_NUMERIC
43688000-4368e000 r--s 00000000 08:05 816354     /home/jpg/SRAGUET/ant/lib/javaVSAXlibrary.jar
496ef000-49705000 r--p 00000000 08:05 829393     /usr/share/locale/fr_FR/LC_CTYPE
49705000-4970e000 r--s 00000000 08:05 1010195    /home/jpg/SRAGUET/junit3.2/lib/junitTools.jar
4970f000-49717000 r-xp 00000000 08:05 536488     /lib/libnss_files-2.1.3.so
49717000-49719000 rw-p 00007000 08:05 536488     /lib/libnss_files-2.1.3.so
49719000-49731000 r--s 00000000 08:05 1010194    /home/jpg/SRAGUET/junit3.2/lib/junit.jar
49731000-49738000 r-xp 00000000 08:05 798578     /home/jpg/SRAGUET/testBuild/PcscRm/libpcscrm.so
49738000-4973a000 rw-p 00006000 08:05 798578     /home/jpg/SRAGUET/testBuild/PcscRm/libpcscrm.so
49744000-4974b000 r-xp 00000000 08:05 846502     /usr/lib/libpcsclite.so.0.0.1
4974b000-4974c000 rw-p 00006000 08:05 846502     /usr/lib/libpcsclite.so.0.0.1
 
Local Time = Tue Jan 29 16:19:45 2002
Elapsed Time = 0
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
#
------------------------------------
 
 
when called from a Java application using JNI.
 
Rk: the shared library loaded by the Java application is compiled with '-shared -lpthread -lpcsclite'.
 
Does somebody have an explanation ?

Reply via email to