[vtk-developers] New build error in 64 bits

Jeff Baumes jeff.baumes at kitware.com
Mon Jun 18 16:15:40 EDT 2007


Are you saying that vtkTypeInt64 is typedef-ed to long while
vtkTypeInt64Array's superclass is vtkLongLongArray?  If this is indeed
the case, please provide more details on your system so I can see if I
can replicate it.  The parallel logic in vtkType.h and
Common\CMakeLists.txt seems like it would avoid this type of behavior.
 Here is the relevant cmake script.  VTK_TYPE_NATIVE_Int64 determines
the superclass of vtkTypeInt64.

IF(VTK_SIZEOF_LONG MATCHES "^8$")
  SET(VTK_TYPE_NATIVE_Int64 Long)
  SET(VTK_TYPE_NATIVE_UInt64 UnsignedLong)
ELSE(VTK_SIZEOF_LONG MATCHES "^8$")
  IF(VTK_SIZEOF_LONG_LONG MATCHES "^8$")
    SET(VTK_TYPE_NATIVE_Int64 LongLong)
    SET(VTK_TYPE_NATIVE_UInt64 UnsignedLongLong)
  ELSE(VTK_SIZEOF_LONG_LONG MATCHES "^8$")
    IF(VTK_SIZEOF___INT64 MATCHES "^8$")
      SET(VTK_TYPE_NATIVE_Int64 __Int64)
      IF(VTK_TYPE_CONVERT_UI64_TO_DOUBLE)
        SET(VTK_TYPE_NATIVE_UInt64 Unsigned__Int64)
      ENDIF(VTK_TYPE_CONVERT_UI64_TO_DOUBLE)
    ENDIF(VTK_SIZEOF___INT64 MATCHES "^8$")
  ENDIF(VTK_SIZEOF_LONG_LONG MATCHES "^8$")
ENDIF(VTK_SIZEOF_LONG MATCHES "^8$")

Jeff

On 6/18/07, Mathieu Coursolle <mcoursolle at rogue-research.com> wrote:
> Hi VTK developpers,
>
> When building my 64 bits version of VTK, I encounter a new build error.
>
> The error is caused by a recent change in VTK:
> <http://public.kitware.com/cgi-bin/viewcvs.cgi/IO/vtkDataReader.cxx?
> r1=1.143&r2=1.144>
>
> Line 1167 and 1187:
> vtkTypeInt64 *ptr = ((vtkTypeInt64Array *)array)-
> >WritePointer(0,numTuples*numComp);
> vtkTypeUInt64 *ptr = ((vtkTypeUInt64Array *)array)-
> >WritePointer(0,numTuples*numComp);
>
> vtkTypeInt64 is either defined as a long or a long long according to
> VTK_USE_LONG_LONG.
> (See vtkType.h (end of email)).
>
> However, vtkTypeInt64Array is a subclass of vtkLongLongArray, causing a
> type mismatch error
> when vtkTypeInt64 is of type long. Even if they are both 8 bytes, their
> type is different and
> the compiler can not do the conversion.
>
> Should WritePointer be overloaded in vtkTypeInt64Array to make sure the
> return type is the
> expected one?
>
> Thank you.
>
> Mathieu
>
>
> /* Select a 64-bit integer type.  */
> #if VTK_SIZEOF_LONG == 8
> typedef unsigned long vtkTypeUInt64;
> typedef signed long   vtkTypeInt64;
> # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG
> # define VTK_TYPE_INT64 VTK_LONG
> #elif defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8
> typedef unsigned long long vtkTypeUInt64;
> typedef signed long long   vtkTypeInt64;
> # define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG_LONG
> # define VTK_TYPE_INT64 VTK_LONG_LONG
> #elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8
> typedef unsigned __int64 vtkTypeUInt64;
> typedef signed __int64   vtkTypeInt64;
> # define VTK_TYPE_UINT64 VTK_UNSIGNED___INT64
> # define VTK_TYPE_INT64 VTK___INT64
> #else
> # error "No native data type can represent a 64-bit integer."
> #endif
>
> --
> ____________________________________________________________
> Mathieu Coursolle                   mcoursolle at rogue-research.com
> Rogue Research                      www.rogue-research.com
> Montréal, Québec, Canada
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>


-- 
Jeff Baumes
R&D Engineer, Kitware Inc.
(518) 371-3971 x132
jeff.baumes at kitware.com



More information about the vtk-developers mailing list