Skip to content

Commit a0eb686

Browse files
committed
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 (<cstddef>). 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 <cstddef> 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
1 parent 636aa17 commit a0eb686

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Wrapping/Tools/vtkWrapPython.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ int main(int argc, char *argv[])
385385
"#include \"vtkPythonArgs.h\"\n"
386386
"#include \"vtkPythonOverload.h\"\n"
387387
"#include \"vtkConfigure.h\"\n"
388+
"#include <cstddef>\n"
388389
"#include <sstream>\n");
389390

390391
/* vtkPythonCommand is needed to wrap vtkObject.h */

0 commit comments

Comments
 (0)