[vtkusers] Coding Errors in VTK Java

Jeff Lee jeff at cdnorthamerica.com
Tue May 21 06:14:00 EDT 2002


Dale,
Do you have some sample code that exhibits the problem?  I assure you 
that what you have below is compeletly valid with jni.
-Jeff

Dale Greer wrote:

>There are some fatal coding errors in the Java interface to the vtk dll's.
>For example, in vtkPoints, there's a declaration for GetPoint which returns
>a pointer to a float on the stack. But in Java, GetPoint returns a reference
>to a double array. If GetPoint is used in Java, the first element in the
>double
>array is valid, but the other two are not.
>
>C++
>
>float* vtkPoints::GetPoint( vtkdType id)
>
>Java
>
>  private native double[] GetPoint_26(int id0);
>  public double[] GetPoint(int id0)
>    { return GetPoint_26(id0); }
>
>
>Even worse, the C++ way to get back an array of doubles is to pass by
>reference in the argument, which isn't possible in Java, but which is
>nevertheless attempted by the autogenerated Java interface to the dll.
>
>C++
>
>void vtkPoints::GetPoint( vtkIdType id, double x[3])
>
>Java
>
>  private native void GetPoint_27(int id0,double id1[]);
>  public void GetPoint(int id0,double id1[])
>    { GetPoint_27(id0,id1); }
>
>
>Having pinpointed the problem, I'm not sure if I know how to fix this. Is
>there someone else who could put a fix for this into the nightly build?
>
>Dale
>
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
>
>





More information about the vtkusers mailing list