Re: Interfacing a dynamic shared library gives me different results in 2.7 versus 3.5

2016-05-24 Thread Siyi Deng
Here is a summary of what I did with numpy and the dll I have verified that the values entering the last dll call (dl.cfunction) are identical across platforms. The c function has a signature as follows: int cfunction(int len_data, float* data, int* ac, int num_ac, int flag1, int

Re: Interfacing a dynamic shared library gives me different results in 2.7 versus 3.5

2016-05-24 Thread Siyi Deng
The c function has a signature as follows: int cfun(int len_data, float* data, int* a, int num_a, int flag1, int flag2, int flag3, float* param, float* out1, float* out2, float* out3) and in python: import numpy as np import ctypes as ct data = np.atleast_2d(np.float32(data

Re: Interfacing a dynamic shared library gives me different results in 2.7 versus 3.5

2016-05-24 Thread Siyi Deng
Hello ChrisA, I don't quite understand, the binary shared library contains no python interfaces, it should be independent of python. As a matter of fact, I have successfully used it in Conda python 2.7, 3.5, Julialang as well as c++ executables. I think the fact that only stock python 2.7 faile

Re: Interfacing a dynamic shared library gives me different results in 2.7 versus 3.5

2016-05-24 Thread Siyi Deng
Thanks for all the replies. It turned out that the Apple OS X stock python 2.7 gives the wrong results, but other distributions like 2.7 from miniconda gives the correct results. Facepalm. -- https://mail.python.org/mailman/listinfo/python-list

Interfacing a dynamic shared library gives me different results in 2.7 versus 3.5

2016-05-22 Thread Siyi Deng
I have a dynamic library doing some numerical computations. I used ctypes to interact it by passing numpy arrays back and forth. Python 3.5 gives me the correct results. Python 2.7 gives me different, erroneous results, but it never crashes. How is this possible? There is no string operatio