[SciPy-dev] [mlabwrap] linker path

Clemens Buchacher drizzd@aon...
Mon Oct 19 17:20:24 CDT 2009


Hi,

If I understand correctly, mlabwrap is now maintained as part of the scikits
project. Since the latest release 1.1-pre from the old project site does not
even compile out of the box, I'm assuming the latest version from the SVN
repo is the most usable one.

However, contrary to 1.1-pre (after fixing it up with the patch below), it
requires matlab to be added to the linker path. I really don't want that,
because matlab contains old versions of standard libraries such as zlib and
libstdc++. Since we only need libeng.so, libmat.so, libmx.so and libut.so,
wouldn't it be much nicer to create a directory with symlinks to those
instead?

Cheers,
Clemens

-->o--
Subject: [PATCH] non-const required by Py_DECREF

---
 mlabraw.cpp |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mlabraw.cpp b/mlabraw.cpp
index 18a972d..429102d 100644
--- a/mlabraw.cpp
+++ b/mlabraw.cpp
@@ -310,7 +310,7 @@ static inline void copyCplxNumeric2Mx(T *p,int size,double *pRData,double *pIDat
     }
 }
 
-static mxArray *makeMxFromNumeric(const PyArrayObject *pSrc)
+static mxArray *makeMxFromNumeric(PyArrayObject *pSrc)
 {
   npy_intp lRows=0, lCols=0;
   bool lIsComplex;
@@ -320,7 +320,7 @@ static mxArray *makeMxFromNumeric(const PyArrayObject *pSrc)
   mxArray *lRetval = NULL;
   mwSize dims[NPY_MAXDIMS];
   mwSize nDims = pSrc->nd;
-  const PyArrayObject *ap=NULL;
+  PyArrayObject *ap=NULL;
 
   switch (pSrc->nd) {
   case 0:                       // XXX the evil 0D
@@ -353,7 +353,7 @@ static mxArray *makeMxFromNumeric(const PyArrayObject *pSrc)
 
   // converts to fortran order if not already
   if(!PyArray_ISFORTRAN(pSrc)){ 
-    ap = (const PyArrayObject *)PyArray_FromArray((PyArrayObject*)pSrc,NULL,NPY_ALIGNED|NPY_F_CONTIGUOUS);
+    ap = (PyArrayObject *)PyArray_FromArray((PyArrayObject*)pSrc,NULL,NPY_ALIGNED|NPY_F_CONTIGUOUS);
   }
   else{
     ap = pSrc;
@@ -501,13 +501,13 @@ static mxArray *numeric2mx(PyObject *pSrc)
 
   pyassert(PyArray_API, "Unable to perform this function without NumPy installed");
   if (PyArray_Check(pSrc)) {
-    lDst = makeMxFromNumeric((const PyArrayObject *)pSrc);
+    lDst = makeMxFromNumeric((PyArrayObject *)pSrc);
   } else if (PySequence_Check(pSrc)) {
     lDst = makeMxFromSeq(pSrc);
   } else if (PyObject_HasAttrString(pSrc, "__array__")) {
     PyObject *arp;
     arp = PyObject_CallMethod(pSrc, "__array__", NULL);
-    lDst = makeMxFromNumeric((const PyArrayObject *)arp);
+    lDst = makeMxFromNumeric((PyArrayObject *)arp);
     Py_DECREF(arp);             // FIXME check this is correct;
   }
     else if (PyInt_Check(pSrc) || PyLong_Check(pSrc) ||
-- 
1.6.5.1



More information about the Scipy-dev mailing list