8000 Changes to JNI wrapper required for Windows · wcork/arrayfire-java@ec0df5e · GitHub
[go: up one dir, main page]

8000 Skip to content
< 8000 div class="prc-PageHeader-PageHeader-sT1Hp">

Commit ec0df5e

Browse files
author
pradeep
committed
Changes to JNI wrapper required for Windows
1 parent bdec205 commit ec0df5e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/java_wrapper.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,20 @@ JNIEXPORT jlong JNICALL Java_com_arrayfire_Array_createEmptyArray(JNIEnv *env, j
9999
return ret;
100100
}
101101

102-
#define CREATE_ARRAY_T(Ty, ty) \
102+
#define CREATE_ARRAY_T_(Ty, ty, wty) \
103103
JNIEXPORT jlong JNICALL Java_com_arrayfire_Array_createArrayFrom##Ty \
104104
(JNIEnv *env, jclass clazz, jintArray dims, j##ty##Array elems) \
105105
{ \
106106
jlong ret; \
107107
try{ \
108108
jint* dimptr = env->GetIntArrayElements(dims,0); \
109-
j##ty* inptr= env->Get##Ty##ArrayElements(elems,0); \
109+
wty* inptr= (wty*)env->Get##Ty##ArrayElements(elems,0); \
110110
af::array *A = new af::array(dimptr[0],dimptr[1], \
111-
dimptr[2],dimptr[3],inptr); \
111+
dimptr[2],dimptr[3],inptr);\
112112
\
113113
ret = (jlong)(A); \
114114
env->ReleaseIntArrayElements(dims,dimptr,0); \
115-
env->Release##Ty##ArrayElements(elems,inptr,0); \
115+
env->Release##Ty##ArrayElements(elems,(j##ty*)inptr,0); \
116116
} catch(af::exception& e) { \
117117
ret = 0; \
118118
} catch(std::exception& e) { \
@@ -121,10 +121,14 @@ JNIEXPORT jlong JNICALL Java_com_arrayfire_Array_createEmptyArray(JNIEnv *env, j
121121
return ret; \
122122
} \
123123

124+
125+
#define CREATE_ARRAY_T(Ty, ty) CREATE_ARRAY_T_(Ty, ty, ty)
126+
124127
CREATE_ARRAY_T(Float, float);
125128
CREATE_ARRAY_T(Double, double);
126129
CREATE_ARRAY_T(Int, int);
127-
CREATE_ARRAY_T(Boolean, boolean);
130+
131+
CREATE_ARRAY_T_(Boolean, boolean, bool);
128132

129133
#undef CREATE_ARRAY_T
130134

0 commit comments

Comments
 (0)
0