Skip to content

Commit

Permalink
force sigar_set_pointer use 64bit pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
cnstar9988 authored Nov 20, 2020
1 parent ad47dc3 commit 9e5dba8
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions bindings/java/src/jni/javasigar.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,8 @@ static void *sigar_get_pointer(JNIEnv *env, jobject obj) {
jfieldID pointer_field;
jclass cls = JENV->GetObjectClass(env, obj);

#ifdef SIGAR_POINTER_LONG
pointer_field = JENV->GetFieldID(env, cls, "longSigarWrapper", "J");
return (void *)JENV->GetLongField(env, obj, pointer_field);
#else
pointer_field = JENV->GetFieldID(env, cls, "sigarWrapper", "I");
return (void *)JENV->GetIntField(env, obj, pointer_field);
#endif
}

static jni_sigar_t *sigar_get_jpointer(JNIEnv *env, jobject obj) {
Expand All @@ -218,13 +213,8 @@ static void sigar_set_pointer(JNIEnv *env, jobject obj, const void *ptr) {
jfieldID pointer_field;
jclass cls = JENV->GetObjectClass(env, obj);

#ifdef SIGAR_POINTER_LONG
pointer_field = JENV->GetFieldID(env, cls, "longSigarWrapper", "J");
JENV->SetLongField(env, obj, pointer_field, (jlong)ptr);
#else
pointer_field = JENV->GetFieldID(env, cls, "sigarWrapper", "I");
JENV->SetIntField(env, obj, pointer_field, (int)ptr);
#endif
}

/* for jni/win32 */
Expand Down

3 comments on commit 9e5dba8

@cnstar9988
Copy link
Owner Author

@cnstar9988 cnstar9988 commented on 9e5dba8 Nov 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebuid it on win64+vs2015 base on sigar 1.6.4, I checked.
you can download from the following links, it show a picture, you download it ,and rename it to sigar-amd64-winnt.dll, it works well with sigar 1.6.4.

sigar-amd64-winnt.dll
md5:
adeeb56eb62e4929440b9a7f52efdfe4
sha1:
b0a070dc77d6f4751c39df13cf1a9fc4775b8933

please rebuild by you self.
https://github.com/cnstar9988/sigar/raw/master/sigar-amd64-winnt.dll

@jps17183
Copy link

@jps17183 jps17183 commented on 9e5dba8 Apr 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but then where do I place the .dll file? Besides my processor is an intel not amd. (I don't know if this is anything to do with it).

@ewangplay
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! My sigar version is 1.6.5.132, I download the dll file and replace the old one, it also works well!

Please sign in to comment.