Commit 4ef267b1 authored by David Gobbi's avatar David Gobbi
Browse files

Add extern template decls for vtkPythonArgs::Array

This is needed to avoid "no definition is available" clang warnings for
C++ compilation.
parent b5e0dd73
......@@ -21,6 +21,9 @@ more efficient and flexible that the original PyArg_ParseTuple() code,
resulting in wrapper code that is faster and more compact.
-----------------------------------------------------------------------*/
// Keep vtkPythonArgs.h from declaring "externs" for what we define here
#define VTK_PYTHON_ARGS_CXX
#include "vtkPythonArgs.h"
#include "vtkPythonUtil.h"
......@@ -1376,17 +1379,11 @@ vtkPythonArgs::Array<T>::Array(Py_ssize_t n) : Pointer(0)
}
}
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<bool>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<float>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<double>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<char>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<signed char>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned char>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<short>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned short>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<int>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned int>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<long>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned long>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<long long>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned long long>;
// Instantiate the Array class template over all types:
#define vtkForPythonArrayTypeMacro(type) \
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<type>;
vtkExpandForPythonArrayTypesMacro()
#undef vtkForPythonArrayTypeMacro
......@@ -805,4 +805,35 @@ PyObject *vtkPythonArgs::BuildBytes(const char *a, int n)
return PyBytes_FromStringAndSize(a, n);
}
// List of all types for the Array class template:
#define vtkExpandForPythonArrayTypesMacro() \
vtkForPythonArrayTypeMacro(bool) \
vtkForPythonArrayTypeMacro(float) \
vtkForPythonArrayTypeMacro(double) \
vtkForPythonArrayTypeMacro(char) \
vtkForPythonArrayTypeMacro(signed char) \
vtkForPythonArrayTypeMacro(unsigned char) \
vtkForPythonArrayTypeMacro(short) \
vtkForPythonArrayTypeMacro(unsigned short) \
vtkForPythonArrayTypeMacro(int) \
vtkForPythonArrayTypeMacro(unsigned int) \
vtkForPythonArrayTypeMacro(long) \
vtkForPythonArrayTypeMacro(unsigned long) \
vtkForPythonArrayTypeMacro(long long) \
vtkForPythonArrayTypeMacro(unsigned long long)
// Forward declare the Array class template over all types:
#if !defined(VTK_PYTHON_ARGS_CXX) && \
!defined(_MSC_VER) && !defined(__MINGW32__)
#define vtkForPythonArrayTypeMacro(type) \
extern template class vtkPythonArgs::Array<type>;
vtkExpandForPythonArrayTypesMacro()
#undef vtkForPythonArrayTypeMacro
#endif
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment