[f2py] f2py c flags

Pearu Peterson pearu.peterson at gmail.com
Wed Jun 30 14:58:12 EEST 2010


On Wed, Jun 30, 2010 at 2:15 PM, Sam Tygier
<Sam.Tygier at hep.manchester.ac.uk> wrote:
> hello
>
> f2py has options for setting fortran compile flags, --f77flags and
> --f90flags, but there are no equivalent c flag options documented. do
> they exist?

No. These flags are defined in numpy.distutils config_fc command
(that f2py internally uses for compiling fortran codes)
while for compiling C code f2py completely
relies on distutils features.

> using:
> CFLAGS="--std=c99" f2py ...
> seems to work. is this the recommended method? should it be documented.

Yes, afaik this is what distutils recommends.

Another option is to build C library with your favorite compiler options (
plus options like -fPIC to support shared libraries)
and just use `-lmyfavoriteclib` in f2py command line when building
Python extension module.

> Also is it possible to use f2py directives directly in C code? i can't
> find any examples of this.

No. Though it is in my todo list. So, the current solution is still to
to use .c files and a .pyf file in parallel.

HTH,
Pearu



More information about the f2py-users mailing list