wesm/pandas — Issue #460: Master does not compile on windows
Author: dieterv77
Created: 2011-12-07 19:24:05+00:00
State: open

I ran into issues compiling current master on windows. The problem is with the new pandas/src/numpyhelper.h file

There are two issues there:
1. MSVC does not support "inline" in C (see http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx)
It does support _inline in C however, which has the intended meaning as far as i can tell.

2. MSVC does not support pointer arithmetic on void *. I fixed that with simple cast.

There's a diff below, it only show how to make it compile on windows, and is not portable. I didn't put this in a pull request because i'm not sure how you would like to make changes that are portable.

```
diff --git a/pandas/src/numpy_helper.h b/pandas/src/numpy_helper.h
index f5779dd..fe40e8c 100644
--- a/pandas/src/numpy_helper.h
+++ b/pandas/src/numpy_helper.h
@@ -1,30 +1,30 @@
#include "Python.h"
#include "numpy/ndarrayobject.h"

-inline int
+_inline int
is_integer_object(PyObject* obj) {
return PyArray_IsIntegerScalar(obj);
}

-inline int
+_inline int
is_float_object(PyObject* obj) {
return (PyFloat_Check(obj) || PyArray_IsScalar(obj, Floating));
}

-inline int
+_inline int
is_bool_object(PyObject* obj) {
return (PyBool_Check(obj) || PyArray_IsScalar(obj, Bool));
}

-inline int
+_inline int
is_string_object(PyObject* obj) {
return (PyString_Check(obj) || PyUnicode_Check(obj));
}

-inline int
+_inline int
assign_value_1d(PyArrayObject* ap, Py_ssize_t _i, PyObject* v) {
char *item;
npy_intp i = (npy_intp) _i;
- item = PyArray_DATA(ap) + i * PyArray_STRIDE(ap, 0);
+ item = (char *) PyArray_DATA(ap) + i * PyArray_STRIDE(ap, 0);
return PyArray_DESCR(ap)->f->setitem(v, item, ap);
}
```