UnsatisfiedLinkError: Attempt to access invalid address
843829Jul 9 2002 — edited Jul 10 2002If I try to run my JavaAppl, I always get the following message. Something seems to be wrong with the operation call uread() of the Library foxapi.lib. If I disable this operation (with //), I get the Defaultvalue=5 back. So the jni seems to work. But what's wrong with this operation?? In a C++-Prog this Operation doesnt's make any problems. I often use the foxapi.lib and it works well.
Any idea?
Thanks Patric
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\XBatch\java2fox.dll:
Attempt to access invalid address
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at PLCIFImpFox.<clinit>(PLCIFImpFox.java:18)
at MainApp.<init>(MainApp.java:16)
at MainApp.main(MainApp.java:22)
Source of java2fox.c
#ifndef __NT__
#define __NT__ 1
#endif
#include <jni.h>
#include <foxapi.h>
#include "PLCIFImpFox.h"
#include <stdio.h>
JNIEXPORT void JNICALL
Java_PLCIFImpFox_helloWorldNat(JNIEnv *env, jobject obj) {
printf("Native Inteface!\n");
}
JNIEXPORT jint JNICALL
Java_PLCIFImpFox_readDataInt(JNIEnv *env, jobject obj, jstring addr) {
int gw[2] = {1,1};
int valType[2] = {2,2};
int nument = 2;
int reterr;
int error[2];
long value[2] = {5,6};
int status[2];
char name[2][32];
strncpy(name[0], "TEST:TEST.II0001", 32);
strncpy(name[1], "TEST:TEST.II0002", 32);
uread(gw,&nument,name,valType,value,status,error,&reterr);
return (jint)value[0];
}