Skip to content

Add #include for offsetof() macro in generated Python wrappers

The generated Python wrappers use the C offsetof() macro, but don't #include the header that defines the macro (). For example, see https://gitlab.kitware.com/vtk/vtk/blob/636aa17/Wrapping/Tools/vtkWrapPythonClass.c#L553.

This commit adds the proper header to the generated Python wrappers. Without this, wrapping could fail unless is indirectly included through the header of the class being wrapped. An example error message is:

Libs/MRML/Core/vtkMRMLSubjectHierarchyConstantsPython.cxx:853:40: error: ‘offsetof’ was not declared in this scope
   offsetof(PyVTKObject, vtk_weakreflist), // tp_weaklistoffset

Merge request reports