I have seen a similar question to mine asked however it didn't really help. I have C/C++ API that I want to use in java. The C/C++ interface return error codes (C/C++ enums) and I want to map these directly to java enums. I have a JNI wrapper and was wondering how to do this.
Asked
Active
Viewed 290 times
0
-
@Erwin: This is not (clearly) a duplicate (but I don’t know how to contest that). The linked question is about returning an enum value defined in Java to C(++). This question seems to be about the opposite: returning an enum value defined in C(++) to Java. – PJTraill May 25 '15 at 13:06
-
If you had already seen the question suggested as a duplicate and thought that did not help, I am afraid it is probably your only possibility. If you want an enum in Java, you are going to have to add a Java definition (anything like Reflection via JNI sounds absurd, does it not?). Once you have done that, you can apply the method described in [how to return enum from JNI](http://stackoverflow.com/questions/11225261/how-to-return-enum-from-jni). – PJTraill May 25 '15 at 13:11