Re: [f2py] f2py c flags

Pearu Peterson <[email protected]>
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
On Wed, Jun 30, 2010 at 2:15 PM, Sam Tygier
<[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.