Dag Sverre Seljebotn wrote:
> 1) A "fortran" calling convention on external function declarations, and
> perhaps a "module"/"namespace" declaration (which one could reuse for
> C++):
>
> cdef extern:
> module mymodule: # reusable for C++ wrapping, could say "namespace"
> instead
> cdef fortran sometype myfunc(sometype arg)
Fine with me. What about
cdef extern from "myheader.h":
for C and
cdef extern from module "mymodule":
for Fortran and
cdef extern from namespace "mynamespace":
for C++, which would automatically enable C, C++ and Fortran conventions
for their body? (i.e. without a "fortran" or "module" keyword).
> When "fortran" is in effect, one may accept some extra syntax for the
> arguments, i.e. "in" or "inout" (but "const" and no const could serve
> the same purpose).
I'm for using in/inout (maybe as a Py3 annotation or whatever) rather than
overloading "const".
> 2) Types -- I am thinking of a "cython.fortran" psuedomodule with
> Fortran types (i.e. cython.fortran.real(kind=8)); these would simply map
> down to C typedefs. But one could get by with a simple pxd with no
> compiler support as well.
I'm not sure what would be a good way to handle this. If it's an external
.pxd, I don't mind. But requiring compiler support here may open a can of
worms.
> 3) Potentially parsing of Fortran files to autogenerate pxd files, but
> this could be a seperate tool and/or be pluggable using an API that
> could also be used for header files.
Sounds like a separate tool to me.
> Implementation-wise, there would be a transform which would deal with
> calls to functions using the Fortran calling convention, and generates a
> mymodule.f90 wrapper to supplement mymodule.c -- however this is a very
> thin wrapper to retype the Fortran functions from Fortran-side to use
> some C conventions and some Cython-specific conventions, and most of the
> things would be C-side.
Wouldn't the external .pxd generator tool be the right place to also
generate the .f90 wrapper? I don't see Cython generate a Fortran module
while compiling a Cython module to C code that *calls* the module.
Maybe a second backend to F2Py would do the trick already?
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev