This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Windows applications, bind C and Cygwin64
- From: FX <fxcoudert at gmail dot com>
- To: Angelo Graziosi <angelo dot graziosi at alice dot it>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, Tobias Burnus <burnus at net-b dot de>, Janne Blomqvist <blomqvist dot janne at gmail dot com>
- Date: Fri, 26 Jul 2013 17:02:36 +0200
- Subject: Re: Windows applications, bind C and Cygwin64
- References: <B2AE7406-6549-4BB2-B8DA-EA4B99905C96 at gmail dot com> <51F28E46 dot 3040009 at alice dot it>
> If I understand what Janne and Tobias wrote, there isn't any bug but only the choice of linux strategy for Cygwin64,
Yes, it's not a bug, it's Cygwin64's choice.
> which makes things a little more complicated to program with iso c binding.
Not exactly. Using C binding will get you exactly what you want, which is it will bind Fortran types to C types. The problem in your case is the difference between C types as provided by the compiler (which follows Cygwin64's ABI choice, i.e. long is 64-bit), compared to the C types used in Win32/Win64 API's (which require a 32-bit LONG type).
So, it's not a Fortran / C binding question, it's a compiler vs. OS API question.
> It seems that the suggestions of Tobias fix some of the issues I meet.
Yes, just assume that Win32/64's LONG type is your compiler's "int" type (and not "long"), and you should be fine.
FX