using stdint with swig and numpy.i

删除回忆录丶 提交于 2019-12-05 19:05:57

Haha, I found some "solution" just a few minutes after I gave up and posted this question.

I edited the numpy.ito fit my cause: I substituted the old C types with stdint.h types in lines 3044 ff:

[..]
/* Concrete instances of the %numpy_typemaps() macro: Each invocation
 * below applies all of the typemaps above to the specified data type.
 */
%numpy_typemaps(int8_t       , NPY_BYTE     , int)
%numpy_typemaps(uint8_t     , NPY_UBYTE    , int)
%numpy_typemaps(int16_t             , NPY_SHORT    , int)
%numpy_typemaps(uint16_t    , NPY_USHORT   , int)
%numpy_typemaps(int32_t               , NPY_INT      , int)
%numpy_typemaps(uint32_t      , NPY_UINT     , int)
%numpy_typemaps(long              , NPY_LONG     , int)
%numpy_typemaps(unsigned long     , NPY_ULONG    , int)
%numpy_typemaps(int64_t         , NPY_LONGLONG , int)
%numpy_typemaps(uint64_t, NPY_ULONGLONG, int)
%numpy_typemaps(float             , NPY_FLOAT    , int)
%numpy_typemaps(double            , NPY_DOUBLE   , int)
[..]

I wonder if anyone has a better idea than editing the numpy.i

Cheers Jochen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!