jnative调用C的dll动态类库

质能方程 发布于 2012/07/16 15:08
阅读 1K+
收藏 0

@红薯 你好,想跟你请教个问题:C语言生成的dll动态类库里有结构体,结构体里有指针,这个怎么调用啊?我只要以调用eclipse就会出错,比如:C语言的结构如下定义

typedef struct {

    char* name;

    int age;

} User;

它就会报如下的错误

#

# A fatal error has been detected by the Java Runtime Environment:

#

#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x647516ad, pid=1304, tid=324

#

# JRE version: 7.0-b147

# Java VM: Java HotSpot(TM) Client VM (21.0-b17 mixed mode, sharing windows-x86 )

# Problematic frame:

# C  [Rectification.dll+0x116ad]

#

# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

#

# An error report file with more information is saved as:

# F:\workspace602\test602dl\hs_err_pid1304.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.

#

如果是

typedef struct {

    char name[20];

    int age;

} User;

 运行的时候就不会报错?这个怎么解决啊?

 

 

 

 

以下是问题补充:

@质能方程:而且该结构还作为里传入参数和返回值!!传入参数是以User*u指针形式传入的,传入也是以指针的形式传出的 (2012/07/17 19:47)
加载中
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部