下面的示例代码对我来说看起来不错,但如果使用 GCC 4.0.2 编译,在 Solaris 上执行总是失败并出现 SIGBUS 错误,但是如果使用 GCC 3.4.2 版本编译,它运行良好。任何想法?
//params is a pointer to a structure Param, which has a member d whose type is double. It was initiated/allocated through JNI.
params->d = 5.0;
double *b = ¶ms->d;
double c = params->d;
c += *b;
SIGBUS 在最后一行提出,即取消引用指针并访问内容导致了问题。
谢谢,查尔斯