Stefan Behnel wrote:
> Dag Sverre Seljebotn wrote:
>> Actually, I slipped here. Pointers would be "inout", i.e.
>>
>> cdef fortran void myfunc(int* foo) # foo is inout argument
>>
>> I would *not* like to have Cython code where "myfunc(x)" can change the
>> value of x :-)
>>
>> But for array/buffer arguments, "in"/"out"/"inout" would be nice to have.
> 
> In that case, could they be declared as part of the array/buffer
> declaration (inside the []), instead of becoming an external part of the
> variable declaration?

Yes, I think so.

Actually, I think passing acquired buffers to/from C code would be nice 
to have, and could be done using the same mechanism. in/out/inout is 
needed then as well, so this is not Fortran-specific.

> The only question is what generates the F90 wrapper, and I don't think
> it's the compiler that compiles the Cython sources. In most use cases I
> can see, you will generate the wrapper once (or once in a while), but your
> Cython code many, many times during development. So this really is a
> different tool that generates different code (from the same .pxd file).

Yes, I can see where you are coming from and it is certainly something 
to consider. On one end, work on f2py to in addition generate Cython 
wrapper around a generated C interface for Fortran. On the other end, 
add Cython syntax candy for passing acquired buffers to C code. Taken 
together, they should get us there without specific Fortran support in 
Cython.

I think I'll/we'll need to think more about it and perhaps CEP it with 
pros and cons and get back to it. I'm getting more ideas as I write 
here. Thanks for stimulating feedback.

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to