[Numpy-discussion] PyGTK breaks fortran extension???

Pauli Virtanen pav at iki.fi
Fri Sep 3 04:22:20 EDT 2010


Fri, 03 Sep 2010 08:53:00 +0300, Åsmund Hjulstad wrote:
> I have a f2py wrapped fortran extension, compiled using gcc-mingw32
> (v.4.5.0), numpy 1.5, Python 2.7, where I am experiencing the strangest
> behaviour. It appears that loading pygtk breaks my fortran extension.

Be aware that "import gtk" sets the current locale.

You can reset it with
"import locale; locale.setlocale(locale.LC_ALL, 'C')".

Depending on the platform, the locale might for example alter how your 
Fortran runtime parses floating point numbers (i.e., whether the decimal 
separator is "," or "."). For instance, in some old versions of gfortran 
this *was* a problem -- changing the C locale would break the Fortran 
runtime, making it stop the program with some obscure assertion.

> The fortran code has initialization code (it calculates reference state
> for a combination of fluids). The initialization appearantly has some
> sanity checks, verifying the results. This initialization fails if gtk
> is loaded first.

How does it fail? Knowing this could help debugging.

[clip]
> Is is possible that msvcrt.dll has something to do with this?  I haven't
> been able to get my library to link to msvcr90, I guess I have to do
> something with a manifest, but I haven't grasped it yet.  Before using
> the gtk backend of matplotlib, everything worked OK, so I thought it
> wasn't a problem. I have a VS2008PRO DVD on the way in the mail, but was
> hoping to be able to fix this with mingw.

Mixing different runtimes could maybe also be a problem. I'm not an 
expert on this, however.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list