[Numpy-discussion] Numpy 1.9.1, zeros and alignement

Sturla Molden sturla.molden at gmail.com
Wed Nov 19 21:11:49 EST 2014

On 18/11/14 23:10, Pauli Virtanen wrote:

> The second question is whether F2py actually *needs* to check the
> dtype-size alignment, or is just something like sizeof(double) enough
> for Fortran compilers.

The Fortran standard does not specify an ABI so this is likely compiler 

The only safe way of calling Fortran from C is through a proxy Fortran 
routine exported to C using Fortran 2003 ISO C bindings. That is what 
f2py should do behind the scenes now that the Fortran 77 limitation is 
lifted from SciPy.

With this method we can just pass an arbitrary C pointer to Fortran and 
construct a Fortran array pointer with c_f_function. The Fortran 
compiler will make an aligned copy of the array referenced by the 
pointer if required. No special coding will be required to ensure 
correct alignment.


More information about the NumPy-Discussion mailing list