Bug with ISO_C_BINDING on Mac OS?
Angelo Graziosi
angelo.graziosi@alice.it
Sat Jun 1 13:37:00 GMT 2013
Ciao Tobias,
Il 01/06/2013 15.14, Tobias Burnus ha scritto:
> Disclaimer: That's what I quickly gathered from looking at MSDN (see
> below). I might well have missed some fine print or might have made some
> stupid mistake.
>
>
> Note: One can only really talk about the correct interface if one sees
> the full definition/declaration - both of the C code and the Fortran
> code. In addition, there are different choices possible, e.g.
> integer(c_intptr_t) and type(c_ptr) - one just has to use them
> consistently.
You are right... I forgot to show the needed definitions to understand
completely the code.
In the module I have this:
...
integer, parameter, public :: BYTE_T = C_INT8_T
integer, parameter, public :: INT_T = C_INT
integer, parameter, public :: BOOL_T = INT_T
integer, parameter, public :: HANDLE_T = C_INTPTR_T
...
integer, parameter, public :: HDC_T = HANDLE_T
integer, parameter, public :: HWND_T = HANDLE_T
...
public PAINTSTRUCT_T
type, bind(C) :: PAINTSTRUCT_T
integer(HDC_T) :: hdc
integer(BOOL_T) :: fErase
type(RECT_T) :: rcPaint
integer(BOOL_T) :: fRestore
integer(BOOL_T) :: fIncUpdate
integer(BYTE_T) :: rgbReserved(32)
end type PAINTSTRUCT_T
>
> In any case, one has to be careful whether VALUE or not should be passed
> - and about integer sizes as the size of "long" (esp. Windows vs. Linux)
> and of integers storing pointers (esp. 32 vs 64 bit) differs between
> systems. (Finally, one needs to be careful with multi-dimensional arrays
> - and with LOGICAL, except one uses logical(c_bool) together with
> _Bool/boolean/bool.)
>
> PS: Side note, on MSDN, I found the following definitions:
For C code I have followed MSDN, too :)
Thanks for clarification.
Ciao,
Angelo.
More information about the Fortran
mailing list