A
Aditya Rajgarhia
Did you see my suggestion about using SWIG to wrap the structs and passing
Ok, I read the Java part of the manual and ran SWIG on my C code. It
generated the wrapper classes in Java. However, the getters and
setters are created in Java, not in C. For my problem it seems that
they should be in C, like in Tom's original solution. I want to set
the struct in the C code before passing to Java, and then retrieve the
returned (updated) values in C.
Also, SWIG generated the JNI code for calling C code from the Java
code, which is the opposite of what I need.
So if I use SWIG, am I supposed to write the C getters and setter
myself? In that case, there would be no point in using SWIG, if all it
did was to type out the data fields of the classes. The majority of
the work in my case is writing the C getters and setters and the C JNI
code for calling the equivalent Java methods.
Unless I am missing something completely, and the generated code is
indeed what I need. Please point out if so
Thanks
the wrapped structs to java, providing write-through access and so
avoiding any copying? The more i think about it, the more i think this is
a better way to do it than copying. And there's no GC problem.
Ok, I read the Java part of the manual and ran SWIG on my C code. It
generated the wrapper classes in Java. However, the getters and
setters are created in Java, not in C. For my problem it seems that
they should be in C, like in Tom's original solution. I want to set
the struct in the C code before passing to Java, and then retrieve the
returned (updated) values in C.
Also, SWIG generated the JNI code for calling C code from the Java
code, which is the opposite of what I need.
So if I use SWIG, am I supposed to write the C getters and setter
myself? In that case, there would be no point in using SWIG, if all it
did was to type out the data fields of the classes. The majority of
the work in my case is writing the C getters and setters and the C JNI
code for calling the equivalent Java methods.
Unless I am missing something completely, and the generated code is
indeed what I need. Please point out if so
Thanks