Re: [f2py] F2PY: Unable to prevent Fortran ordered array copy
labrach <[email protected]>
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
It seems ok for me with the followings :
(but I don't know how to check if the copy appeared or not, since the
-DF2PY_REPORT_ATEXIT returns an error dealing with undefine reference
to 'on_exit')
I run that on a Windows with mingw 5.1.4
------------------------------------------------------
prog_lib.f
-------------------------------------------------------
subroutine array_incr(tab,n)
cf2py integer,required,intent(in)::n
cf2py integer,intent(inout,c),dimension(n) :: tab
integer n,tab(n)
integer i
do i=1,n
tab(i) = tab(i) + 1
end do
end
------------------------------------------------------
test_inout.py
-------------------------------------------------------
from _MATH import array_incr
from numpy import numarray
N=10
A = numarray.arange(N+1)
print "Before A=",A
array_incr(A,N)
print "After A=",A
------------------------------------------------------
build
-------------------------------------------------------
g77.exe -c src\prog_lib.f -o prog_lib.o
g77.exe -o test_math.exe prog_main.o libMATH.dll
python D:\Python25\scripts\f2py.py -c --fcompiler=g77
--compiler=mingw32 -lmsvcr71 -DF2PY_REPORT_ON_ARRAY_COPY=1 -m _MATH
src\prog_lib.f
------------------------------------------------------
results
-------------------------------------------------------
Before A= [ 0 1 2 3 4 5 6 7 8 9 10]
After A= [ 1 2 3 4 5 6 7 8 9 10 10]