<div dir="ltr"><p dir="ltr">I'm not at all an expert on Fortran ABIs, but I think there are two distinct issues being conflated here.</p>
<p dir="ltr">The first is that there is no standard way to look at some Fortran source code and figure out the corresponding C API. When trying to call a Fortran routine from C, then different Fortran compilers require different sorts of name mangling, different ways of mapping Fortran concepts like "output arguments" onto C concepts like "pointers", etc., so your C code needs to have explicit knowledge of which Fortran compiler is in use. That's what Sturla was referring to with the differences between g77 versus gfortran etc. This is all very annoying, but it isn't a *deep* bad - it can be solved by unilateral action by whatever project wants to link the Fortran library.</p>
<p dir="ltr">The bigger problem is that getting a usable DLL at all is a serious challenge. Some of the issues we deal with: (a) the classic, stable mingw has no 64-bit support, (b) the only portable way to compile fortran (f2c) only works for the ancient fortran 77, (c) getting even mingw-w64 to use a msvc-compatible ABI is not trivial (I have no idea why this is the case, but it is), (d) <a href="https://github.com/rust-lang/rust/issues/1768#issuecomment-4007553" target="_blank"></a>mingw-built dlls normally depend on the mingw runtime dlls. Because these aren't shipped globally with Python, they have to be either linked statically or else a separate copy of them has to be placed into every directory that contains any mingw-compiled extension module.</p><p>All the runtime and ABI issues do mean that it would be much easier to use mingw(-w64) to build extension modules if Python itself were built with mingw(-w64). Obviously this would in turn make it harder to build extensions with MSVC, though, which would be a huge transition. I don't know whether gcc's advantages (support for more modern C, better cross-platform compatibility, better accessibility to non-windows-experts, etc.) would outweigh the transition and other costs.<br></p><p>As an intermediate step, there are almost certainly things that could be done to make it easier to use mingw-w64 to build python extensions, e.g. teaching setuptools about how to handle the ABI issues. Maybe it would even be possible to  ship the mingw runtimes in some globally available location.<br></p><p>-n<br></p>
<div class="gmail_quote">On 11 Oct 2014 17:07, "Steve Dower" <<a href="mailto:Steve.Dower@microsoft.com" target="_blank">Steve.Dower@microsoft.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div>
<div>
<div>
<div style="font-family:Calibri,sans-serif;font-size:11pt">Is there some reason the Fortran part can't be separated out into a DLL? That's the C ABI Antoine was referring to, and most compilers can generate import libraries from binaries, even if the original
 compiler produced then in a different format.<br>
<br>
Top-posted from my Windows Phone</div>
</div>
<div dir="ltr">
<hr>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">From:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:sturla.molden@gmail.com" target="_blank">Sturla Molden</a></span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Sent:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt">‎10/‎11/‎2014 7:22</span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">To:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:python-dev@python.org" target="_blank">python-dev@python.org</a></span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Subject:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt">Re: [Python-Dev] Status of C compilers for Python on Windows</span><br>
<br>
</div>
</div>
<font><span style="font-size:10pt">
<div>Antoine Pitrou <<a href="mailto:solipsis@pitrou.net" target="_blank">solipsis@pitrou.net</a>> wrote:<br>
<br>
> It sound like whatever MSVC produces should be the defacto standard<br>
> under Windows.<br>
<br>
Yes, and that is what Clang does on Windows. It is not as usable as MinGW<br>
yet, but soon it will be. Clang also suffers fronthe lack of a Fortran<br>
compiler, though.<br>
<br>
Sturla<br>
<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/steve.dower%40microsoft.com" target="_blank">
https://mail.python.org/mailman/options/python-dev/steve.dower%40microsoft.com</a><br>
</div>
</span></font>
</div>

<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/njs%40pobox.com" target="_blank">https://mail.python.org/mailman/options/python-dev/njs%40pobox.com</a><br>
<br></blockquote></div>
</div>