From: William S F. <ws...@fu...> - 2007-05-09 19:59:14
|
sr...@cs... wrote: > Hello, > > I am having problems creating creating struct arrays. > Below is the interface file. > > %include "typemaps.i" > > %extend A { > JAVA_ARRAYSOFCLASSES(B) > %apply B[] {B *}; > A(B *radioNuclides, int len); > ~A(); > } > > I am getting the following compilation errors:- > > error: passing argument 2 of â(*jenv)->GetArrayLengthâ makes pointer from > integer without a cast > error: passing argument 2 of â(*jenv)->GetLongArrayElementsâ makes pointer > from integer without a cast > > Please let me know what am i doing wrong and how to correct it. > Apologies for delay in sending a reply. Your example doesn't quite work and doesn't give the errors you show above. I've modified the example to: %module example %include "typemaps.i" %include "arrays_java.i" %inline %{ typedef struct A {} A; typedef struct B {} B; %} %extend A { JAVA_ARRAYSOFCLASSES(B) %apply B[] {B *radioNuclides}; A(B *radioNuclides, int len) {/* do something */ } ~A() { /* do something */ } } Now this compiles and works fine. I can't replicate your error message, but maybe you are compiling C++ JNI code as C code or visa versa. If you invoke swig -c++ you must compile your code as c++ code (eg use g++). Likewise if you don't use swig -c++, then compile your code as c code. William |