当前位置: 技术问答>linux和unix
iconv函数进行字符集转换
来源: 互联网 发布时间:2016-03-26
本文导语: 在动态库里调用iconv,编译该动态库是加入了-liconv选项,用java调用该库时出错,提示如下: An unexpected exception has been detected in native code outside the VM.//VM是指Java VM,即java虚拟机 Unexpected Signal : 11 occurred at PC...
在动态库里调用iconv,编译该动态库是加入了-liconv选项,用java调用该库时出错,提示如下:
An unexpected exception has been detected in native code outside the VM.//VM是指Java VM,即java虚拟机
Unexpected Signal : 11 occurred at PC=0xD328988E
Function=libiconv+0x4B
Library=/usr/local/lib/libiconv.so.2.4.0
Current Java thread:
at MyJava.Encode(Native Method)
at MyJava.main(MyJava.java:19)
Dynamic libraries:
0x8050000 /export/home/a/j2sdk1.4.2_08/bin/java
0xd3270000 /usr/local/lib/libiconv.so
0xd3240000 /usr/lib/libthread.so.1
0xd337d000 /usr/lib/libdl.so.1
0xd3170000 /usr/lib/libc.so.1
0xd3150000 /usr/local/lib/libgcc_s.so.1
0xd2dd0000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/client/libjvm.so
0xd2da0000 /usr/lib/libCrun.so.1
0xd2d80000 /usr/lib/libsocket.so.1
0xd2cd0000 /usr/lib/libnsl.so.1
0xd2c90000 /usr/lib/libm.so.1
0xd2c70000 /usr/lib/libsched.so.1
0xd2c50000 /usr/lib/libmp.so.2
0xd27e0000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/native_threads/libhpi.so
0xd27a0000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/libverify.so
0xd2750000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/libjava.so
0xd2730000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/libzip.so
0xd0390000 /usr/lib/locale/zh_CN.GB18030/zh_CN.GB18030.so.2
0xd09f0000 /usr/lib/locale/zh_CN.GB18030/methods_zh_CN.GB18030.so.2
0xd0090000 /usr/local/lib/libencode.so
0xcdf10000 /usr/local/lib/libstdc++.so.6
Heap at VM Abort:
Heap
def new generation total 576K, used 169K [0xc5c00000, 0xc5ca0000, 0xc60e0000)
eden space 512K, 33% used [0xc5c00000, 0xc5c2a468, 0xc5c80000)
from space 64K, 0% used [0xc5c80000, 0xc5c80000, 0xc5c90000)
to space 64K, 0% used [0xc5c90000, 0xc5c90000, 0xc5ca0000)
tenured generation total 1408K, used 0K [0xc60e0000, 0xc6240000, 0xc9c00000)
the space 1408K, 0% used [0xc60e0000, 0xc60e0000, 0xc60e0200, 0xc6240000)
compacting perm gen total 4096K, used 1521K [0xc9c00000, 0xca000000, 0xcdc00000)
the space 4096K, 37% used [0xc9c00000, 0xc9d7c6f8, 0xc9d7c800, 0xca000000)
Local Time = Mon Jun 16 00a:48:41 2008
Elapsed Time = 8
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_08-b03 mixed mode)
#
iconv是包含在libiconv里的函数,我装的libiconv版本是libiconv-1.11-sol9-x86-local
若在可执行文件里调用iconv则没任何问题,但到了动态库里调用iconv就不行,不知为何?
An unexpected exception has been detected in native code outside the VM.//VM是指Java VM,即java虚拟机
Unexpected Signal : 11 occurred at PC=0xD328988E
Function=libiconv+0x4B
Library=/usr/local/lib/libiconv.so.2.4.0
Current Java thread:
at MyJava.Encode(Native Method)
at MyJava.main(MyJava.java:19)
Dynamic libraries:
0x8050000 /export/home/a/j2sdk1.4.2_08/bin/java
0xd3270000 /usr/local/lib/libiconv.so
0xd3240000 /usr/lib/libthread.so.1
0xd337d000 /usr/lib/libdl.so.1
0xd3170000 /usr/lib/libc.so.1
0xd3150000 /usr/local/lib/libgcc_s.so.1
0xd2dd0000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/client/libjvm.so
0xd2da0000 /usr/lib/libCrun.so.1
0xd2d80000 /usr/lib/libsocket.so.1
0xd2cd0000 /usr/lib/libnsl.so.1
0xd2c90000 /usr/lib/libm.so.1
0xd2c70000 /usr/lib/libsched.so.1
0xd2c50000 /usr/lib/libmp.so.2
0xd27e0000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/native_threads/libhpi.so
0xd27a0000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/libverify.so
0xd2750000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/libjava.so
0xd2730000 /export/home/a/j2sdk1.4.2_08/jre/lib/i386/libzip.so
0xd0390000 /usr/lib/locale/zh_CN.GB18030/zh_CN.GB18030.so.2
0xd09f0000 /usr/lib/locale/zh_CN.GB18030/methods_zh_CN.GB18030.so.2
0xd0090000 /usr/local/lib/libencode.so
0xcdf10000 /usr/local/lib/libstdc++.so.6
Heap at VM Abort:
Heap
def new generation total 576K, used 169K [0xc5c00000, 0xc5ca0000, 0xc60e0000)
eden space 512K, 33% used [0xc5c00000, 0xc5c2a468, 0xc5c80000)
from space 64K, 0% used [0xc5c80000, 0xc5c80000, 0xc5c90000)
to space 64K, 0% used [0xc5c90000, 0xc5c90000, 0xc5ca0000)
tenured generation total 1408K, used 0K [0xc60e0000, 0xc6240000, 0xc9c00000)
the space 1408K, 0% used [0xc60e0000, 0xc60e0000, 0xc60e0200, 0xc6240000)
compacting perm gen total 4096K, used 1521K [0xc9c00000, 0xca000000, 0xcdc00000)
the space 4096K, 37% used [0xc9c00000, 0xc9d7c6f8, 0xc9d7c800, 0xca000000)
Local Time = Mon Jun 16 00a:48:41 2008
Elapsed Time = 8
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_08-b03 mixed mode)
#
iconv是包含在libiconv里的函数,我装的libiconv版本是libiconv-1.11-sol9-x86-local
若在可执行文件里调用iconv则没任何问题,但到了动态库里调用iconv就不行,不知为何?
|
length2赋值了吗?
|
单纯看你贴出来的代码没发现问题。
能不能把你的makefile编译参数贴出来看看?
还有,不知道你是怎么进行你所说的验证的?两者的环境分别是怎样的?
|
Unexpected Signal : 11 occurred at PC=0xD328988E
这个问题好像和ivonv没有关系,建议你去看看
http://forum.java.sun.com/thread.jspa?threadID=307252&messageID=2480412
这个问题好像和ivonv没有关系,建议你去看看
http://forum.java.sun.com/thread.jspa?threadID=307252&messageID=2480412