java中用jna调用动态链接库,c中的char**是对应java中的String[]吗?
如题,我在java中获取该char**型返回值,总是报错。##AfatalerrorhasbeendetectedbytheJavaRuntimeEnvironment:...
如题,我在java中获取该char**型返回值,总是报错。
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fe3e09ded5f, pid=20697, tid=140616713938688
#
# JRE version: 7.0_21-b11
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.21-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libc.so.6+0x132d5f] __strlen_sse42+0xf
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /usr/local/hadoop/CPPToJava/hs_err_pid20697.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
# 展开
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fe3e09ded5f, pid=20697, tid=140616713938688
#
# JRE version: 7.0_21-b11
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.21-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libc.so.6+0x132d5f] __strlen_sse42+0xf
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /usr/local/hadoop/CPPToJava/hs_err_pid20697.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
# 展开
1个回答
展开全部
用StringBuffer试试
追问
感谢回答!它提示类型不符合,我看网上良少的博客,说char** 对应String[],我调用前在C程序中直接打印指针的地址是正确的,在java中调用再打印地址就错了,出现混乱状况。是不是内存泄露造成的?是否因为没有手动释放内存?
追答
诶 这就不了解了
jna就用过一次
现在java对dll的应用还在学习中
感觉做这种需要调用外部库的程序用java写有点伤
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询